[logback-dev] svn commit: r885 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic/net logback-examples/src/main/java/chapter4/conf logback-examples/src/main/java/chapter4/db logback-site/src/site/xdocTemplates/manual

noreply.seb at qos.ch noreply.seb at qos.ch
Wed Nov 8 15:41:09 CET 2006


Author: seb
Date: Wed Nov  8 15:41:08 2006
New Revision: 885

Added:
   logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-syslog.xml
Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
   logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-Console.xml
   logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-HtmlToConsole.xml
   logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-MDC.xml
   logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTP.xml
   logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTPWithHtml.xml
   logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-c3p0.xml
   logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-pooled-datasource.xml
   logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml

Log:
On going work on chapter 4
- Modified sample configs
- Added begin of SyslogAppender doc

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java	Wed Nov  8 15:41:08 2006
@@ -24,7 +24,7 @@
 
   String prefixPattern;
   
-  static final public String DEFAULT_SUFFIX_PATTERN = "[%thread] %logger %m%exception";
+  static final public String DEFAULT_SUFFIX_PATTERN = "[%thread] %logger %msg %exception";
   
   public Layout buildLayout(String facilityStr) {
   

Modified: logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-Console.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-Console.xml	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-Console.xml	Wed Nov  8 15:41:08 2006
@@ -3,8 +3,7 @@
   <appender name="STDOUT"
     class="ch.qos.logback.core.ConsoleAppender">
     <layout class="ch.qos.logback.classic.PatternLayout">
-      <param name="Pattern"
-        value="%-4relative [%thread] %-5level - %msg %n" />
+      <Pattern>%-4relative [%thread] %-5level - %msg %n</Pattern>
     </layout>
   </appender>
 

Modified: logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-HtmlToConsole.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-HtmlToConsole.xml	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-HtmlToConsole.xml	Wed Nov  8 15:41:08 2006
@@ -4,10 +4,9 @@
     class="ch.qos.logback.core.ConsoleAppender">
     <layout class="ch.qos.logback.classic.html.HTMLLayout">
       <cssBuilder class="ch.qos.logback.core.helpers.CssBuilder">
-      	<param name="url" value="path_to_StyleFile.css" />
+      	<url>path_to_StyleFile.css</url>
       </cssBuilder>	
-      <param name="Pattern"
-        value="%-4relative [%thread] %-5level - %msg%n" />
+      <Pattern>%-4relative [%thread] %-5level - %msg%n</Pattern>
     </layout>
   </appender>
 

Modified: logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-MDC.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-MDC.xml	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-MDC.xml	Wed Nov  8 15:41:08 2006
@@ -3,8 +3,7 @@
   <appender name="STDOUT"
     class="ch.qos.logback.core.ConsoleAppender">
     <layout class="ch.qos.logback.classic.PatternLayout">
-      <param name="Pattern"
-        value="%-4relative [%thread] %-5level %X{testKey} - %msg%n" />
+      <Pattern>%-4relative [%thread] %-5level %X{testKey} - %msg%n</Pattern>
     </layout>
   </appender>
 

Modified: logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTP.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTP.xml	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTP.xml	Wed Nov  8 15:41:08 2006
@@ -3,15 +3,14 @@
   <appender name="SMTP"
     class="ch.qos.logback.classic.net.SMTPAppender">
     <layout class="ch.qos.logback.classic.PatternLayout">
-      <param name="pattern"
-        value="%-4relative [%thread] %-5level %class - %msg%n" />
+      <Pattern>%-4relative [%thread] %-5level %class - %msg%n</Pattern>
     </layout>
-    <param name="From" value="test.nospam at qos.ch" />
-    <param name="SMTPHost" value="mail.qos.ch" />
+    <From>sender_email at host.ch</From>
+    <SMTPHost>mail.host.ch</SMTPHost>
     
-    <param name="Subject" value="Last Event: %-10logger %nopex" />
+    <Subject>Last Event: %-10logger %nopex</Subject>
     
-    <param name="To" value="sebastien at qos.ch" />
+    <To>recipient_email at host.ch</To>
   </appender>
 
   <root>

Modified: logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTPWithHtml.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTPWithHtml.xml	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-SMTPWithHtml.xml	Wed Nov  8 15:41:08 2006
@@ -3,14 +3,15 @@
   <appender name="SMTP"
     class="ch.qos.logback.classic.net.SMTPAppender">
     <layout class="ch.qos.logback.classic.html.HTMLLayout">
-      <param name="pattern" value="%relative%thread%mdc%level%class%msg" />
+      <pattern>%relative%thread%mdc%level%class%msg</pattern>
       <throwableRenderer class="ch.qos.logback.classic.html.DefaultThrowableRenderer" />      
     </layout>
-    <param name="From" value="test.nospam at qos.ch" />
-    <param name="SMTPHost" value="mail.qos.ch" />
-    <param name="Subject" value="LastEvent: %class - %msg %nopex" />
+    <From>sender_email at host.ch</From>
+    <SMTPHost>mail.host.ch</SMTPHost>
     
-    <param name="To" value="sebastien at qos.ch" />
+    <Subject>Last Event: %-10logger %nopex</Subject>
+    
+    <To>recipient_email at host.ch</To>
   </appender>
 
   <root>

Added: logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-syslog.xml
==============================================================================
--- (empty file)
+++ logback/trunk/logback-examples/src/main/java/chapter4/conf/logback-syslog.xml	Wed Nov  8 15:41:08 2006
@@ -0,0 +1,15 @@
+<configuration>
+
+  <appender name="STDOUT"
+    class="ch.qos.logback.classic.net.SyslogAppender">
+    <SyslogHost>pixie</SyslogHost>
+    <Facility>AUTH</Facility>
+    <SuffixPattern>%-4relative [%thread] %-5level - %msg %n</SuffixPattern>
+  </appender>
+
+  <root>
+    <level value="debug" />
+    <appender-ref ref="STDOUT" />
+  </root>
+</configuration>
+

Modified: logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-c3p0.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-c3p0.xml	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-c3p0.xml	Wed Nov  8 15:41:08 2006
@@ -20,9 +20,7 @@
          <param name="inactivity-timeout" value="200"/>        
          -->                                         
        </dataSource>
-       
-       <user>${user}</user>
-       <password>${password}</password>
+
      </connectionSource>
   </appender>
   

Modified: logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-pooled-datasource.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-pooled-datasource.xml	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/db/append-with-pooled-datasource.xml	Wed Nov  8 15:41:08 2006
@@ -19,9 +19,7 @@
          <initialConnections>10</initialConnections>
          <maxConnections>10</maxConnections>
        </dataSource>
-       
-       <user>${user}</user>
-       <password>${password}</password>
+
      </connectionSource>
   </appender>
 

Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml	(original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml	Wed Nov  8 15:41:08 2006
@@ -2082,9 +2082,109 @@
 		<h3>SyslogAppender</h3>
 		
 		<p>
-			
+			The syslog protocol is a very simple protocol: a syslog sender sends a small 
+			message to a syslog receiver. 
+			The receiver is commonly called <em>syslog daemon</em> or <em>syslog server</em>.
+			Logback can send messages to a remote syslog daemon. This is achieved by using 
+			<a href="../xref/ch/qos/logback/classic/net/SyslogAppender.html"><code>SyslogAppender</code></a>.
+		</p>
+		
+		<p>
+			Here are its options:
 		</p>
 
+		<table>
+			<tr>
+				<th>Option Name</th>
+				<th>Type</th>
+				<th>Description</th>
+			</tr>
+			<tr>
+				<td>
+					<b>
+						<span class="option">SyslogHost</span>
+					</b>
+				</td>
+				<td>
+					<code>String</code>
+				</td>
+				<td>
+					The host name of the syslog server.
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<b>
+						<span class="option">Port</span>
+					</b>
+				</td>
+				<td>
+					<code>String</code>
+				</td>
+				<td>
+					The port number on the syslog server to connect to. Nornally, one would not want 
+					to change the default value, that is <em>514</em>.
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<b>
+						<span class="option">Facility</span>
+					</b>
+				</td>
+				<td>
+					<code>String</code>
+				</td>
+				<td>
+					<p>
+						The <span class="option">Facility</span> is meant to identify 
+						the source of a message.
+					</p>
+					<p>
+						The <span class="option">Facility</span> option must be set one 
+						of the strings <em>KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, 
+						CRON, AUTHPRIV, FTP, NTP, AUDIT, ALERT, CLOCK, LOCAL0, LOCAL1, LOCAL2, 
+						LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7</em>. Case is not important.
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<b>
+						<span class="option">SuffixPattern</span>
+					</b>
+				</td>
+				<td>
+					<code>String</code>
+				</td>
+				<td>
+					<p>
+						The <span class="option">SuffixPattern</span> option specifies the format of the 
+						non-standardized part the message sent to the syslog server. By default, its value
+						is <em>[%thread] %logger %msg %exception</em>. Any value that a <code>PatternLayout</code>
+						could use is a correct <span class="option">SuffixPattern</span>.
+					</p>
+				</td>
+			</tr>
+		</table>
+		
+		<p>
+			The syslog severity of a logging event is converted from the level of the logging event.
+			The <em>DEBUG</em> level is converted to <em>7</em>, <em>INFO</em> is converted to
+			<em>6</em>, <em>WARN</em> is converted to <em>4</em> and <em>ERROR</em> is converted
+			to <em>3</em>.
+		</p>
+		
+		<p>
+			Since the format of a syslog request follows rather strict rules, 
+		</p>
+		
+		
+		
+		
+		
+		
+		
 		<h2>Logback Access</h2>
 		
 		<h3>SMTPAppender</h3>



More information about the logback-dev mailing list