[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.25-14-g3b87986

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Wed Oct 20 23:44:31 CEST 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  3b87986bffa45b6f340b26fecdb177db3f24139b (commit)
      from  268a8ffc8d2f7752ba3013af582679dbc3c12a86 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=3b87986bffa45b6f340b26fecdb177db3f24139b
http://github.com/ceki/logback/commit/3b87986bffa45b6f340b26fecdb177db3f24139b

commit 3b87986bffa45b6f340b26fecdb177db3f24139b
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Wed Oct 20 23:43:00 2010 +0200

    - fix	 LBCORE-170
    - release 0.9.26

diff --git a/logback-access/pom.xml b/logback-access/pom.xml
index 5511f17..0519cc3 100644
--- a/logback-access/pom.xml
+++ b/logback-access/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-parent</artifactId>
-    <version>0.9.26-SNAPSHOT</version>
+    <version>0.9.26</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 2c390a4..1557fac 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-parent</artifactId>
-    <version>0.9.26-SNAPSHOT</version>
+    <version>0.9.26</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/logback-classic/src/test/input/joran/smtp/customBufferSize.xml b/logback-classic/src/test/input/joran/smtp/customBufferSize.xml
new file mode 100644
index 0000000..233bc77
--- /dev/null
+++ b/logback-classic/src/test/input/joran/smtp/customBufferSize.xml
@@ -0,0 +1,22 @@
+<configuration>
+
+  <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
+    <SMTPHost>localhost</SMTPHost>
+    <SMTPPort>${port}</SMTPPort>
+    <To>nospam at qos.ch</To>
+    <From>user at host.dom</From>
+    <Subject>%logger - %m</Subject>
+
+    <CyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
+      <BufferSize>1</BufferSize>
+    </CyclicBufferTracker>
+    
+    <layout class="ch.qos.logback.classic.PatternLayout">
+      <Pattern>%message</Pattern>
+    </layout>
+  </appender>
+
+  <root level="debug">
+    <appender-ref ref="EMAIL" />
+  </root>
+</configuration>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/DilutedSMTPAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/DilutedSMTPAppenderTest.java
index 76b3ae0..5e3f912 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/DilutedSMTPAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/DilutedSMTPAppenderTest.java
@@ -43,8 +43,6 @@ public class DilutedSMTPAppenderTest {
   public void setUp() throws Exception {
     LoggerContext lc = new LoggerContext();
     appender = new SMTPAppender();
-    cbTracker = appender.getCyclicBufferTracker();
-    cb = cbTracker.get("", 0);
     appender.setContext(lc);
     appender.setName("smtp");
     appender.setFrom("user at host.dom");
@@ -53,6 +51,9 @@ public class DilutedSMTPAppenderTest {
     appender.setSubject("logging report");
     appender.addTo("sebastien.nospam at qos.ch");
     appender.start();
+    cbTracker = appender.getCyclicBufferTracker();
+    cb = cbTracker.get("", 0);
+
   }
 
   private static Layout<ILoggingEvent> buildLayout(LoggerContext lc) {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
index 16b2bb3..68733af 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
@@ -218,4 +218,20 @@ public class SMTPAppender_GreenTest {
     String body = GreenMailUtil.getBody(mp.getBodyPart(0));
     assertEquals("helloworld", body);
   }
+
+  @Test
+  public void testCustomBufferSize() throws Exception {
+    configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+        + "smtp/customBufferSize.xml");
+
+    logger.debug("invisible1");
+    logger.debug("invisible2");
+    String msg = "hello";
+    logger.error(msg);
+    MimeMultipart mp = verify(this.getClass().getName() + " - " + msg);
+    String body = GreenMailUtil.getBody(mp.getBodyPart(0));
+    assertEquals(msg, body);
+  }
+
+
 }
diff --git a/logback-core/pom.xml b/logback-core/pom.xml
index 7a7ff55..5880af6 100644
--- a/logback-core/pom.xml
+++ b/logback-core/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-parent</artifactId>
-    <version>0.9.26-SNAPSHOT</version>
+    <version>0.9.26</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
index db5156d..abd4bf6 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
@@ -87,7 +87,7 @@ public abstract class SMTPAppenderBase<E> extends AppenderBase<E> {
   protected EventEvaluator<E> eventEvaluator;
 
   protected Discriminator<E> discriminator = new DefaultDiscriminator<E>();
-  protected CyclicBufferTracker<E> cbTracker = new CyclicBufferTrackerImpl<E>();
+  protected CyclicBufferTracker<E> cbTracker;
 
   private int errorCount = 0;
 
@@ -105,6 +105,11 @@ public abstract class SMTPAppenderBase<E> extends AppenderBase<E> {
    * Start the appender
    */
   public void start() {
+
+    if(cbTracker == null) {
+      cbTracker = new CyclicBufferTrackerImpl<E>();
+    }
+
     Properties props = new Properties(OptionHelper.getSystemProperties());
     if (smtpHost != null) {
       props.put("mail.smtp.host", smtpHost);
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java b/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java
index c424b61..a32a934 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java
@@ -32,9 +32,10 @@ public class CyclicBufferTrackerImpl<E> implements CyclicBufferTracker<E> {
   int bufferCount = 0;
 
   // 5 minutes
-  static final int DELAY_BETWEEN_CLEARING_STALE_BUFFERS = 300*CoreConstants.MILLIS_IN_ONE_SECOND ;
+  static final int DELAY_BETWEEN_CLEARING_STALE_BUFFERS = 300 * CoreConstants.MILLIS_IN_ONE_SECOND;
 
- 
+
+  boolean isStarted = false;
 
   private Map<String, Entry> map = new HashMap<String, Entry>();
 
@@ -52,7 +53,8 @@ public class CyclicBufferTrackerImpl<E> implements CyclicBufferTracker<E> {
     return bufferSize;
   }
 
-  public void setBufferSize(int size) {
+  public void setBufferSize(int bufferSize) {
+    this.bufferSize = bufferSize;
   }
 
   public int getMaxNumberOfBuffers() {
@@ -137,7 +139,7 @@ public class CyclicBufferTrackerImpl<E> implements CyclicBufferTracker<E> {
     return ((entry.timestamp + THRESHOLD) < now);
   }
 
-   List<String> keyList() {
+  List<String> keyList() {
     List<String> result = new LinkedList<String>();
     Entry e = head;
     while (e != tail) {
@@ -146,6 +148,7 @@ public class CyclicBufferTrackerImpl<E> implements CyclicBufferTracker<E> {
     }
     return result;
   }
+
   private void rearrangeTailLinks(Entry e) {
     if (head == tail) {
       head = e;
diff --git a/logback-examples/pom.xml b/logback-examples/pom.xml
index f970d47..3661919 100644
--- a/logback-examples/pom.xml
+++ b/logback-examples/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-parent</artifactId>
-    <version>0.9.26-SNAPSHOT</version>
+    <version>0.9.26</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/logback-examples/src/main/java/chapters/appenders/mail/customBufferSize.xml b/logback-examples/src/main/java/chapters/appenders/mail/customBufferSize.xml
new file mode 100644
index 0000000..6a89723
--- /dev/null
+++ b/logback-examples/src/main/java/chapters/appenders/mail/customBufferSize.xml
@@ -0,0 +1,20 @@
+<configuration>   
+  <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
+
+    <Subject>TESTING: %logger{20} - %m</Subject>
+
+    <SMTPHost>${smtpHost}</SMTPHost>
+    <To>${to}</To>
+    <From>${from}</From>
+    <layout class="ch.qos.logback.classic.html.HTMLLayout"/>
+
+
+    <CyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
+      <BufferSize>1</BufferSize>
+    </CyclicBufferTracker>
+  </appender>
+
+  <root level="DEBUG">
+    <appender-ref ref="EMAIL" />
+  </root>  
+</configuration>  
\ No newline at end of file
diff --git a/logback-site/pom.xml b/logback-site/pom.xml
index 6f66148..bac4512 100644
--- a/logback-site/pom.xml
+++ b/logback-site/pom.xml
@@ -3,7 +3,7 @@
 	<parent>
 		<groupId>ch.qos.logback</groupId>
 		<artifactId>logback-parent</artifactId>
-		<version>0.9.26-SNAPSHOT</version>
+		<version>0.9.26</version>
 	</parent>
 
 	<modelVersion>4.0.0</modelVersion>
diff --git a/logback-site/src/site/pages/css/common.css b/logback-site/src/site/pages/css/common.css
index 874a82c..1c4e954 100644
--- a/logback-site/src/site/pages/css/common.css
+++ b/logback-site/src/site/pages/css/common.css
@@ -130,6 +130,7 @@ table.bodyTable th {
 
 
 table.bodyTable td {
+  vertical-align: text-top;
   padding-left: 0.5ex;
   padding-bottom: 0.5ex;
 }
diff --git a/logback-site/src/site/pages/manual/appenders.html b/logback-site/src/site/pages/manual/appenders.html
index 9c9a3fe..1bfbe1f 100644
--- a/logback-site/src/site/pages/manual/appenders.html
+++ b/logback-site/src/site/pages/manual/appenders.html
@@ -2246,10 +2246,10 @@ Context ctx = new InitialContext(env);</pre>
           
           
           <p>In the absence of this option, <code>SMTPAppender</code>
-          is assigned an <a
+          is assigned an instance of <a
           href="../xref/ch/qos/logback/classic/boolex/OnErrorEvaluator.html">OnErrorEvaluator</a>
-          instance which triggers email transmission when it
-          encounters an event of level <em>ERROR</em> or higher.
+          which triggers email transmission when it encounters an
+          event of level <em>ERROR</em> or higher.
           </p>
 
           <!--
@@ -2270,28 +2270,59 @@ Context ctx = new InitialContext(env);</pre>
 
         </td>
       </tr>
+
       <tr class="alt">
+        <td  valign="top"><b><span class="option">CyclicBufferTracker</span></b>
+        </td>
+        <td><a href="../xref/ch/qos/logback/core/spi/CyclicBufferTracker.html"><code>CyclicBufferTracker</code></a>
+        </td>
+        <td>
+          <p>As the name indicates a <code>CyclicBufferTracker</code>
+          tracks cyclic buffers. It does so based on the keys returned
+          by the <span class="option">Discriminator</span> (see
+          above).
+          </p>
+          <p>If you don't specify a CyclicBufferTracker, an instance
+          of <a
+          href="../xref/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.html">CyclicBufferTrackerImpl</a>
+          will be automatically created. By default, this instance
+          will keep events in a cyclic buffer of size 256. You may
+          change the size with the help of the <code>BufferSize</code>
+          option.</p>
+        </td>
+        
+      </tr>
+      <tr>
         <td><b><span class="option">Username</span></b></td>
         <td><code>String</code></td> <td>The username value to use
         during plain user/password authentication. By default, this
-        parameter is null.  </td> </tr> <tr > <td><b><span
-        class="option">Password</span></b></td>
-        <td><code>String</code></td> <td>The password value to use for
-        plain user/password authentication. By default, this parameter
-        is null.  </td> </tr> <tr class="alt"> <td><b><span
-        class="option">STARTTLS</span></b></td>
-        <td><code>boolean</code></td> <td>If this parameter is set to
-        true, then this appender will issue the STARTTLS command (if
-        the server supports it) causing the connection to switch to
-        SSL. Note that the connection is initially non-encrypted. By
-        default, this parameter is set to false.  </td> </tr> <tr >
+        parameter is null.  </td> 
+      </tr> 
+      <tr class="alt">
+        <td><b><span class="option">Password</span></b></td>
+        <td><code>String</code></td>
+        <td>The password value to use for plain user/password
+        authentication. By default, this parameter is null.  
+        </td>
+      </tr>
+      <tr> 
+        <td><b><span class="option">STARTTLS</span></b> </td>
+        <td><code>boolean</code></td> 
+        <td>If this parameter is set to true, then this appender
+        will issue the STARTTLS command (if the server supports it)
+        causing the connection to switch to SSL. Note that the
+        connection is initially non-encrypted. By default, this
+        parameter is set to false.
+        </td> 
+      </tr>
+      <tr class="alt">
         <td><b><span class="option">SSL</span></b></td>
         <td><code>boolean</code></td> <td>If this parameter is set to
         true, then this appender will open an SSL connection to the
         server. By default, this parameter is set to false.  </td>
-        </tr>
+      </tr>
 
-      <tr  class="alt">
+      <tr>
         <td><b><span class="option">CharsetEncoding</span></b></td>
         <td><code>String</code></td>
         <td>The outgoing email message will be encoded in the
@@ -2432,6 +2463,34 @@ Context ctx = new InitialContext(env);</pre>
     <code>HTMLLayout</code> does not use inline CSS.
     </p>
 
+    <h3><a name="cyclicBufferSize" href="#cyclicBufferSize">Custom buffer size</a></h3>
+
+    <p>By default, the outgoing message will contain the last 256
+    messages seen by <code>SMTPAppender</code>. If your heart so
+    desires, you may set a different buffer size as shown in the next example.
+    </p>
+
+   <p class="example">Example:  <code>SMTPAppender</code> configuration with a custom bufer size (logback-examples/src/main/java/chapters/appenders/mail/customBufferSize.xml)</p>	
+    <pre class="prettyprint source">&lt;configuration>   
+  &lt;appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
+    &lt;SMTPHost>${smtpHost}&lt;/SMTPHost>
+    &lt;To>${to}&lt;/To>
+    &lt;From>${from}&lt;/From>
+    &lt;Subject>TESTING: %logger{20} - %m&lt;/Subject>
+    &lt;Layout class="ch.qos.logback.classic.html.HTMLLayout"/>
+
+    <b>&lt;CyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl"></b>
+      <b>&lt;!-- send just one log entry per email --></b>
+      <b>&lt;BufferSize>1&lt;/BufferSize></b>
+    <b>&lt;/CyclicBufferTracker></b>
+  &lt;/appender>
+
+  &lt;root level="DEBUG">
+    &lt;appender-ref ref="EMAIL" />
+  &lt;/root>  
+&lt;/configuration>    </pre>
+    
+
     <h3>Triggering event</h3>
 
     <p>If the Evaluator property is not set, the
diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html
index 537d28b..f523753 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -29,7 +29,7 @@
     <hr width="80%" align="center" />
 
 
-    <h3>xxxx, 2010 - Release of version 0.9.26</h3>
+    <h3>20th of October, 2010 - Release of version 0.9.26</h3>
 
 
     <p>Fixed <a
@@ -39,12 +39,22 @@
     internally by logback.
     </p>
 
+    <p><code>SMPTAppender</code> now lets users to set a custom buffer
+    size for the outgoing messages. This fixes <a
+    href="http://jira.qos.ch/browse/LBCORE-170">LBCORE-170</a> as
+    requested by Peter Royal.
+    </p>
+
     <p>When stopped, <code>RollingFileAppender</code> now calls
     <code>stop()</code> on its policy objects, fixing <a
     href="http://jira.qos.ch/browse/LBCORE-114">LBCORE-114</a>
     reported by Anders Wallgren.</p>
 
-
+    <p>Added mapping for OFF and ALL levels in <code>JULHelper</code>
+    as requested in <a
+    href="http://jira.qos.ch/browse/LBCLASSIC-226">LBCLASSIC-226</a>
+    by Christian Brensing.
+    </p>
 
     <h3>October 13th, 2010 - Release of version 0.9.25</h3>
 
diff --git a/pom.xml b/pom.xml
index 52bda78..1365c22 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
   
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-parent</artifactId>
-  <version>0.9.26-SNAPSHOT</version>
+  <version>0.9.26</version>
   <packaging>pom</packaging>
   <name>Logback-Parent</name>
   

-----------------------------------------------------------------------

Summary of changes:
 logback-access/pom.xml                             |    2 +-
 logback-classic/pom.xml                            |    2 +-
 .../{customEvaluator.xml => customBufferSize.xml}  |    8 +-
 .../classic/net/DilutedSMTPAppenderTest.java       |    5 +-
 .../classic/net/SMTPAppender_GreenTest.java        |   16 ++++
 logback-core/pom.xml                               |    2 +-
 .../ch/qos/logback/core/net/SMTPAppenderBase.java  |    7 ++-
 .../logback/core/spi/CyclicBufferTrackerImpl.java  |   11 ++-
 logback-examples/pom.xml                           |    2 +-
 .../mail/{mail2.xml => customBufferSize.xml}       |   19 +++--
 logback-site/pom.xml                               |    2 +-
 logback-site/src/site/pages/css/common.css         |    1 +
 logback-site/src/site/pages/manual/appenders.html  |   91 ++++++++++++++++----
 logback-site/src/site/pages/news.html              |   14 +++-
 pom.xml                                            |    2 +-
 15 files changed, 142 insertions(+), 42 deletions(-)
 copy logback-classic/src/test/input/joran/smtp/{customEvaluator.xml => customBufferSize.xml} (75%)
 copy logback-examples/src/main/java/chapters/appenders/mail/{mail2.xml => customBufferSize.xml} (52%)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list