svn commit: r1675 - in logback/trunk: logback-classic/src/test/input/joran logback-classic/src/test/java/ch/qos/logback/classic logback-classic/src/test/java/ch/qos/logback/classic/net logback-core/src/main/java/ch/qos/logback/core/net logback-site/src/site/pages logback-site/src/site/pages/manual

Author: ceki Date: Thu Apr 17 16:52:22 2008 New Revision: 1675 Added: logback/trunk/logback-classic/src/test/input/joran/syslog_147.xml logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TestContants.java - copied, changed from r1666, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/Contants4T.java Removed: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/Contants4T.java Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java logback/trunk/logback-site/src/site/pages/codes.html logback/trunk/logback-site/src/site/pages/manual/appenders.html Log: - renamed Constant4T ad TestConstants - fixed bug 147 which was caused by the user specifying a layout for SyslogAppender. SyslogAppender now disallows the user to set a layout. It also informs the user that the action is disallows directing her to an error page. - updated codes.html in relation to bug 147 - simplified and shortened codes.html Added: logback/trunk/logback-classic/src/test/input/joran/syslog_147.xml ============================================================================== --- (empty file) +++ logback/trunk/logback-classic/src/test/input/joran/syslog_147.xml Thu Apr 17 16:52:22 2008 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration debug="true"> + <appender name="aSYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> + <SyslogHost>127.0.0.1</SyslogHost> + <Facility>LOCAL7</Facility> + <layout class="ch.qos.logback.classic.PatternLayout"> + <pattern>%d %p [%t] %c::%m%n</pattern> + </layout> + </appender> + <root> + <level value="TRACE"/> + <appender-ref ref="aSYSLOG"/> + </root> +</configuration> \ No newline at end of file Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java ============================================================================== --- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java (original) +++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java Thu Apr 17 16:52:22 2008 @@ -64,7 +64,7 @@ pl.start(); String val = pl.doLayout(getEventObject()); // 2006-02-01 22:38:06,212 INFO [main] c.q.l.pattern.ConverterTest - Some message - String regex = Contants4T.ISO_REGEX+" INFO \\[main] c.q.l.c.pattern.ConverterTest - Some message\\s*"; + String regex = TestContants.ISO_REGEX+" INFO \\[main] c.q.l.c.pattern.ConverterTest - Some message\\s*"; assertTrue(val.matches(regex)); } @@ -86,7 +86,7 @@ pl.start(); String val = pl.doLayout(getEventObject()); // 2008-03-18 21:55:54,250 [main] c.q.l.c.pattern.ConverterTest - Some message - String regex = Contants4T.ISO_REGEX+" \\[main] c.q.l.c.p.ConverterTest - Some message\\s*"; + String regex = TestContants.ISO_REGEX+" \\[main] c.q.l.c.p.ConverterTest - Some message\\s*"; System.out.println(val); assertTrue(val.matches(regex)); @@ -123,7 +123,7 @@ pl.start(); String val = pl.doLayout(getEventObject()); // 2006-02-01 22:38:06,212 INFO [main] c.q.l.pattern.ConverterTest - Some message - String regex = Contants4T.ISO_REGEX+" INFO \\[main] c.q.l.c.pattern.ConverterTest - Some message\\s*"; + String regex = TestContants.ISO_REGEX+" INFO \\[main] c.q.l.c.pattern.ConverterTest - Some message\\s*"; assertTrue(val.matches(regex)); } Copied: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TestContants.java (from r1666, /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/Contants4T.java) ============================================================================== --- /logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/Contants4T.java (original) +++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TestContants.java Thu Apr 17 16:52:22 2008 @@ -9,7 +9,9 @@ */ package ch.qos.logback.classic; -public class Contants4T { +public class TestContants { final static public String ISO_REGEX = "\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3}"; + + final static public String JORAN_ONPUT_PREFIX = "src/test/input/joran"; } Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java ============================================================================== --- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java (original) +++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java Thu Apr 17 16:52:22 2008 @@ -19,7 +19,7 @@ public static Test suite() { TestSuite suite = new TestSuite(); - suite.addTestSuite(SyslogAppenderTest.class); + suite.addTest(new JUnit4TestAdapter(SyslogAppenderTest.class)); suite.addTestSuite(SMTPAppenderTest.class); suite.addTest(new JUnit4TestAdapter(SocketAppenderTest.class)); suite.addTestSuite(JMSTopicAppenderTest.class); Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java ============================================================================== --- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java (original) +++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java Thu Apr 17 16:52:22 2008 @@ -9,26 +9,34 @@ */ package ch.qos.logback.classic.net; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.LoggerFactory; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.TestContants; +import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.classic.net.mock.MockSyslogServer; +import ch.qos.logback.core.joran.spi.JoranException; import ch.qos.logback.core.net.SyslogConstants; +import ch.qos.logback.core.util.StatusPrinter; -public class SyslogAppenderTest extends TestCase { - - public SyslogAppenderTest(String arg0) { - super(arg0); - } +public class SyslogAppenderTest { - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { } - protected void tearDown() throws Exception { - super.tearDown(); + @After + public void tearDown() throws Exception { } + @Test public void testBasic() throws InterruptedException { int port = MockSyslogServer.PORT + 1; @@ -53,7 +61,7 @@ logger.addAppender(sa); String logMsg = "hello"; logger.debug(logMsg); - //StatusPrinter.print(lc.getStatusManager()); + // StatusPrinter.print(lc.getStatusManager()); // wait max 2 seconds for mock server to finish. However, it should // much sooner than that. @@ -73,6 +81,7 @@ } + @Test public void testException() throws InterruptedException { int port = MockSyslogServer.PORT + 2; MockSyslogServer mockServer = new MockSyslogServer(21, port); @@ -98,29 +107,45 @@ String exMsg = "just testing"; Exception ex = new Exception(exMsg); logger.debug(logMsg, ex); - //StatusPrinter.print(lc.getStatusManager()); + // StatusPrinter.print(lc.getStatusManager()); // wait max 2 seconds for mock server to finish. However, it should // much sooner than that. mockServer.join(8000); assertTrue(mockServer.isFinished()); - - //message + 20 lines of stacktrace + + // message + 20 lines of stacktrace assertEquals(21, mockServer.getMessageList().size()); -// int i = 0; -// for (String line: mockServer.msgList) { -// System.out.println(i++ + ": " + line); -// } - + // int i = 0; + // for (String line: mockServer.msgList) { + // System.out.println(i++ + ": " + line); + // } + String msg = mockServer.getMessageList().get(0); String expected = "<" + (SyslogConstants.LOG_MAIL + SyslogConstants.DEBUG_SEVERITY) + ">"; assertTrue(msg.startsWith(expected)); - + String expectedPrefix = "<\\d{2}>\\w{3} \\d{2} \\d{2}(:\\d{2}){2} \\w* "; String threadName = Thread.currentThread().getName(); - String expectedResult = expectedPrefix + "\\[" + threadName + "\\] " + loggerName - + " " + logMsg; + String expectedResult = expectedPrefix + "\\[" + threadName + "\\] " + + loggerName + " " + logMsg; assertTrue(msg.matches(expectedResult)); } + + @Test + public void bug147() throws JoranException { + + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + + JoranConfigurator configurator = new JoranConfigurator(); + configurator.setContext(lc); + lc.shutdownAndReset(); + configurator.doConfigure(TestContants.JORAN_ONPUT_PREFIX + + "/syslog_147.xml"); + + org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass()); + logger.info("hello"); + StatusPrinter.print(lc); + } } Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java ============================================================================== --- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java (original) +++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java Thu Apr 17 16:52:22 2008 @@ -5,10 +5,13 @@ import java.net.UnknownHostException; import ch.qos.logback.core.AppenderBase; +import ch.qos.logback.core.CoreGlobal; import ch.qos.logback.core.Layout; public abstract class SyslogAppenderBase<E> extends AppenderBase<E> { + final static String SYSLOG_LAYOUT_URL = CoreGlobal.CODES_URL + "#syslog_layout"; + Layout<E> layout; int facility; String facilityStr; @@ -44,7 +47,7 @@ super.start(); } } - + abstract public Layout<E> buildLayout(String facilityStr); abstract public int getSeverityForEvent(Object eventObject); @@ -182,15 +185,13 @@ this.port = port; } - /** - * You can override - */ + public Layout<E> getLayout() { return layout; } public void setLayout(Layout<E> layout) { - this.layout = layout; + addWarn("The layout of a SyslogAppender cannot be set directly. See also "+SYSLOG_LAYOUT_URL); } @Override Modified: logback/trunk/logback-site/src/site/pages/codes.html ============================================================================== --- logback/trunk/logback-site/src/site/pages/codes.html (original) +++ logback/trunk/logback-site/src/site/pages/codes.html Thu Apr 17 16:52:22 2008 @@ -2,7 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> -<title>Logback FAQ</title> +<title>Logback Error Codes</title> <link rel="stylesheet" type="text/css" media="screen" href="css/site.css" /> </head> @@ -23,380 +23,243 @@ <h2><a name="top">Logback error messages and their meanings</a></h2> - <ol type="1"> + <p><a name="null_CS" href="#null_CS"> + contextSelector cannot be null + </a> + </p> - <li> - <a href="#null_CS">contextSelector cannot be null</a> - </li> + <p>XXXXXXXXXXX</p> - <li> - <a href="#tbr_fnp_not_set">The <b>FileNamePattern</b> option - must be set before using <code>TimeBasedRollingPolicy</code> or - <code>FixedWindowRollingPolicy</code> - </a> - </li> + <hr/> - <li> - <a href="#fwrp_parentFileName_not_set">The <span - class="option">File</span> option must be set before - <code>FixedWindowRollingPolicy</code> - </a> - </li> - - <li> - <a href="#socket_no_host">No remote host or address is set - for <code>SocketAppender</code> - </a> - </li> - - <li> - <a href="#socket_no_port">No remote port is set for - <code>SocketAppender</code> - </a> - </li> - - - <li> - <a href="#smtp_no_layout"> - No <code>Layout</code> is set for appender - </a> - </li> - - <li> - <a href="#sbtp_size_format"> - Specified number is not in proper int form, or - not expected format. - </a> - </li> - - <li> - <a href="#rfa_no_tp"> - No <code>TriggeringPolicy</code> was set for the - <code>RollingFileAppender</code> - </a> - </li> - - <li> - <a href="#rfa_no_rp"> - No <code>RollingPolicy</code> was set for the - <code>RollingFileAppender</code> - </a> - </li> - </ol> - - - <h2>Error codes and their meanings</h2> - - <dl> - <dt> - <a name="null_CS"> - contextSelector cannot be null - </a> - </dt> - - <dd> - - - </dd> + <p> + <a name="tbr_fnp_not_set" href="#tbr_fnp_not_set"> + The <b>FileNamePattern</b> option must be set before using + <code>TimeBasedRollingPolicy</code> or + <code>FixedWindowRollingPolicy</code> + </a> + </p> - <dt> - <a name="tbr_fnp_not_set"> - The <b>FileNamePattern</b> option must be set before using - <code>TimeBasedRollingPolicy</code> or - <code>FixedWindowRollingPolicy</code> - - </a> - </dt> - - <dd> - <p>The <b>FileNamePattern</b> option for both - <code>TimeBasedRollingPolicy</code> and - <code>FixedWindowRollingPolicy</code> is mandatory. - </p> - - <p>See the <a - href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.html"> - FixedWindowRollingPolicy javadoc - </a> for more information. - - </p> + + <p>The <b>FileNamePattern</b> option for both + <code>TimeBasedRollingPolicy</code> and + <code>FixedWindowRollingPolicy</code> is mandatory. + </p> + + <p>See the <a + href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.html"> + FixedWindowRollingPolicy javadoc </a> for more information. + </p> - <table border="0"> - <tr> - <td align="right"><a href="#top">[top]</a></td> - </tr> - </table> - <hr /> - </dd> - - <dt> - <a name="fwrp_parentFileName_not_set"> - The <span class="option">File</span> option must be set before - <code>FixedWindowRollingPolicy</code> - </a> - </dt> + <hr /> - <dd> - <p>The <span class="option">File</span> option is mandatory with - <code>FixedWindowRollingPolicy</code>. Moreover, the <span - class="option">File</span> option must be set before the - <code>FixedWindowRollingPolicy</code> element. - </p> - - <p>Refer to the logback manual on - <a href="manual/appenders.html#FixedWindowRollingPolicy"> - FixedWindowRollingPolicy - </a> - for more information. - </p> + <p> + <a name="fwrp_parentFileName_not_set" href="#fwrp_parentFileName_not_set"> + The <span class="option">File</span> option must be set before + <code>FixedWindowRollingPolicy</code> + </a> + </p> + + <p>The <span class="option">File</span> option is mandatory with + <code>FixedWindowRollingPolicy</code>. Moreover, the <span + class="option">File</span> option must be set before the + <code>FixedWindowRollingPolicy</code> element. + </p> + + <p>Refer to the logback manual on + <a href="manual/appenders.html#FixedWindowRollingPolicy"> + FixedWindowRollingPolicy </a> for more information. + </p> - <table border="0"> - <tr> - <td align="right"> - <a href="#top">[top]</a> - </td> - </tr> - </table> - <hr /> - - </dd> - - <dt> - <a name="socket_no_host">No remote host or address is set for - <code>SocketAppender</code> - </a> - </dt> - <dd> - <p>A remote host or address is mandatory for SocketAppender. - </p> - <p>You can specify the remote host in the configuration file - like this: - </p> - - <div class="source"><pre> -<appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender"> + <hr /> + + <p> + <a name="socket_no_host" href="#socket_no_host">No remote host or + address is set for <code>SocketAppender</code> + </a> + </p> + + <p>A remote host or address is mandatory for SocketAppender. </p> + <p>You can specify the remote host in the configuration file + as follows. + </p> + + <p class="source"><appender name="SOCKET" + class="ch.qos.logback.classic.net.SocketAppender"> ... - <param name="remoteHost" value="127.0.0.1"></param> + <remoteHost>127.0.0.1</remoteHost> ... -</appender></pre> - </div> - - <table border="0"> - <tr> - <td align="right"> - <a href="#top">[top]</a> - </td> - </tr> - </table> - <hr /> - </dd> - - <dt> - <a name="socket_no_port">No remote port is set for - <code>SocketAppender</code> - </a> - </dt> +</appender></p> + + + <hr /> + + <p> + <a name="socket_no_port" href="#socket_no_port">No remote port is set for + <code>SocketAppender</code> + </a> + </p> - <dd> - <p>A remote port is mandatory for SocketAppender. - </p> - - <p>You can specify the remote port in the configuration file - like this: - </p> + <p>A remote port is mandatory for SocketAppender.</p> - <div class="source"><pre> -<appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender"> + <p>You can specify the remote port in the configuration file + like this: + </p> + + <p class="source"><appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender"> ... - <param name="port" value="4560"></param> + <port>4560</port> ... -</appender></pre> - </div> +</appender></p> - <table border="0"> - <tr> - <td align="right"> - <a href="#top">[top]</a> - </td> - </tr> - </table> - <hr /> - </dd> - - <dt> - <a name="smtp_no_layout">No <code>Layout</code> is set for - appender</a> - </dt> - <dd> - <p>A <code>Layout</code> is mandatory for - <code>SMTPAppender</code> . It allows the appender format the - logging events before sending the email. Two layouts are often - used with <code>SMTPAppender</code> : - <code>PatternLayout</code> and <code>HTMLLayout</code> . - </p> - - <p>You can specify the <code>Layout</code> in the - configuration file like this: - </p> + + <hr /> + + + <p> + <a name="smtp_no_layout" href="#smtp_no_layout"> + No <code>Layout</code> is set for SMTPAppender</a> + </p> + + <p>A <code>Layout</code> is mandatory for + <code>SMTPAppender</code>. It allows SMPTPAppender to format logging + events before sending an email. + </p> + + <p>You can specify the <code>Layout</code> in a configuration file + as follows: + </p> - <div class="source"><pre> -<appender name="SMTP" class="ch.qos.logback.classic.net.SMTPAppender"> + <p class="source"><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"></param> - </layout> + <pattern>%date [%thread] %-5level %logger - %msg%n"></pattern> + </layout> ... -</appender></pre> - - </div> +</appender></p> + + <p>SMTPAppender is known to work well with <a + href="manual/layouts.html#ClassicPatternLayout">PatternLayout</a> + and <a + href="manual/layouts.html#ClassicHTMLLayout">HTMLLayout</a>. + </p> + + + <hr /> + + <p> + <a name="sbtp_size_format" href="#sbtp_size_format">Specified number is not in proper + int form, or not expected format. + </a> + </p> + + <p>When you specify the MaxFileSize to be used by the + SizeBasedRollingPolicy, logback expects a rather precise + format: + </p> + + <ul> + <li>The number has to be an integer</li> + <li>You can add 'KB', 'MB' or 'GB' after the number. + </li> + </ul> - <p>You can see more examples in the - <a href="http://logback.qos.ch/apidocs/ch/qos/logback/classic/html/HTMLLayout.html"> - HTMLLayout javadoc - </a> and the - <a href="http://logback.qos.ch/apidocs/ch/qos/logback/classic/PatternLayout.html"> - PatternLayout javadoc - </a> - </p> - - <table border="0"> - <tr> - <td align="right"> - <a href="#top">[top]</a> - </td> - </tr> - </table> - <hr /> - - - </dd> - <dt> - <a name="sbtp_size_format">Specified number is not in proper - int form, or not expected format. + <p>Here are some correct values: 500KB, 15MB, 2GB.</p> + + <hr /> + + <p><a name="rfa_no_tp" href="#rfa_no_tp">No <code>TriggeringPolicy</code> was set for + the <code>RollingFileAppender</code>. + </a> + </p> + + <p>The <code>RollingFileAppender</code> must be set up with a + <code>TriggeringPolicy</code>. It permits the Appender to know when + the rollover must be activated. + </p> + + <p>To find more information about <code>TriggeringPolicy</code> + objects, please read the following javadocs: + </p> + + <ul> + <li> + <a + href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.html"><code>SizeBasedTriggeringPolicy</code> </a> - </dt> - - <dd> - <p>When you specify the MaxFileSize to be used by the - SizeBasedRollingPolicy, logback expects a rather precise - format: - </p> - - <ul> - <li>The number has to be an integer</li> - <li>You can add 'KB', 'MB' or 'GB' after the number. - </li> - </ul> - - <p>Here are some correct values: 500KB, 15MB, 2GB.</p> - - <table border="0"> - <tr> - <td align="right"> - <a href="#top">[top]</a> - </td> - </tr> - </table> - <hr /> - - </dd> - <dt> - <a name="rfa_no_tp">No <code>TriggeringPolicy</code> was set - for the <code>RollingFileAppender</code>. + </li> + <li> + <a + href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.html"><code>TimeBasedRollingPolicy</code> </a> - </dt> + </li> + </ul> + + <p>Please note that the <code>TimeBasedRollingPolicy</code> + is a TriggeringPolicy <em>and</em> and + <code>RollingPolicy</code> at the same time. + </p> + + <hr /> + + + <p> + <a name="rfa_no_rp" href="#rfa_no_rp">No <code>RollingPolicy</code> was set + for the <code>RollingFileAppender</code>. + </a> + </p> + + <p>The <code>RollingFileAppender</code> must be set up with + a <code>RollingPolicy</code>. It permits the Appender to + know what to do when a rollover is requested. + </p> + + <p>To find more information about <code>RollingPolicy</code> + objects, please read the following javadocs: + </p> - <dd> - <p>The <code>RollingFileAppender</code> must be set up with a - <code>TriggeringPolicy</code>. It permits the Appender to know - when the rollover must be activated. - </p> - - <p>To find more information about <code>TriggeringPolicy</code> - objects, please read the following javadocs: - </p> - - <ul> - <li> - <a - href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.html"><code>SizeBasedTriggeringPolicy</code> - </a> - </li> - <li> - <a - href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.html"><code>TimeBasedRollingPolicy</code> - </a> - </li> - </ul> - - <p>Please note that the <code>TimeBasedRollingPolicy</code> - is a TriggeringPolicy <em>and</em> and - <code>RollingPolicy</code> at the same time. - </p> - - - <table border="0"> - <tr> - <td align="right"> - <a href="#top">[top]</a> - </td> - </tr> - </table> - <hr /> - - </dd> - <dt> - <a name="rfa_no_rp">No <code>RollingPolicy</code> was set - for the <code>RollingFileAppender</code>. + <ul> + <li> + <a href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.html"> + <code>FixedWindowRollingPolicy</code> </a> - </dt> - - <dd> - <p>The <code>RollingFileAppender</code> must be set up with - a <code>RollingPolicy</code>. It permits the Appender to - know what to do when a rollover is requested. - </p> - - <p>To find more information about <code>RollingPolicy</code> - objects, please read the following javadocs: - </p> - - <ul> - <li> - <a href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.html"> - <code>FixedWindowRollingPolicy</code> - </a> - </li> - <li> - <a href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.html"> - <code>TimeBasedRollingPolicy</code> - </a> - </li> - </ul> - - <p>Please note that the <code>TimeBasedRollingPolicy</code> is a - <code>TriggeringPolicy</code> <em>and</em> and RollingPolicy at - the same time. - </p> - - - <table border="0"> - <tr> - <td align="right"> - <a href="#top">[top]</a> - </td> - </tr> - </table> - - </dd> + </li> + <li> + <a href="http://logback.qos.ch/apidocs/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.html"> + <code>TimeBasedRollingPolicy</code> + </a> + </li> + </ul> + + <p>Please note that the <code>TimeBasedRollingPolicy</code> is a + <code>TriggeringPolicy</code> <em>and</em> and RollingPolicy at + the same time. + </p> + + + <hr/> + + + <p><a name="syslog_layout" href="#syslog_layout"> SyslogAppender + does not admit a layout parameter.</a> + </p> - - - - </dl> + <p>Given that the format of a syslog request follows strict rules, + you cannot freely specify the layout to be used with + SyslogAppender. However, you can use <span + class="option">SuffixPattern</span> option instead to influence the + contents of the message sent to the syslog daemon. + </p> + + <p>For more information on SyslogAppeder please refer to the <a + href="manual/appenders.html#SyslogAppender">its documentation.</a> + </p> + <hr/> + + <script src="templates/footer.js"></script> </div> </body> Modified: logback/trunk/logback-site/src/site/pages/manual/appenders.html ============================================================================== --- logback/trunk/logback-site/src/site/pages/manual/appenders.html (original) +++ logback/trunk/logback-site/src/site/pages/manual/appenders.html Thu Apr 17 16:52:22 2008 @@ -2707,9 +2707,12 @@ The gain is a <em>10</em> factor. </p> - <a name="SyslogAppender"></a> - <h3>SyslogAppender</h3> - + <h3> + <a name="SyslogAppender" href="#SyslogAppender"> + SyslogAppender + </a> + </h3> + <p> The syslog protocol is a very simple protocol: a syslog sender sends a small message to a syslog receiver. @@ -2718,9 +2721,7 @@ <a href="../xref/ch/qos/logback/classic/net/SyslogAppender.html"><code>SyslogAppender</code></a>. </p> - <p> - Here are its options: - </p> + <p>Here are the options upi can pass to a SyslogAppender.</p> <table class="bodyTable"> <tr class="a"> @@ -2777,21 +2778,22 @@ </p> </td> </tr> - <tr class="a"> - <td> - <b> - <span class="option">SuffixPattern</span> - </b> + <tr class="a"> + <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>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</em>. Any value that a + <code>PatternLayout</code> could use is a correct <span + class="option">SuffixPattern</span> value. </p> </td> </tr> @@ -2822,7 +2824,7 @@ class="ch.qos.logback.classic.net.SyslogAppender"> <SyslogHost>remote_home</SyslogHost> <Facility>AUTH</Facility> - <SuffixPattern>%-4relative [%thread] %-5level - %msg</SuffixPattern> + <SuffixPattern>[%thread] %logger %msg</SuffixPattern> </appender> <root> @@ -2831,21 +2833,21 @@ </root> </configuration></pre></div> - <p> - When testing this configuration, one should verify that the remote syslog daemon - accepts requests from an external source. Experience shows that syslog daemons - usually deny such requests by default. + <p>When testing this configuration, you should verify that the + remote syslog daemon accepts requests from an external + source. Experience shows that, by default, syslog daemons usually + deny requests coming via a network connection. </p> <a name="Access"></a> <h2>Logback Access</h2> - <p> - Most of the appenders found in logback classic can be used within - logback access. They function mostly in the same way as their logback - classic counterpart. In the next section, we will cover their use, but will - focuse on the differences with the classic appenders. + <p>Most of the appenders found in logback classic can be used + within logback access. They function mostly in the same way as + their logback classic counterpart. In the next section, we will + cover their use, but will focuse on the differences with the + classic appenders. </p> <a name="AccessSocketAppender"/>
participants (1)
-
noreply.ceki@qos.ch