[Bug 147] New: ch.qos.logback.classic.net.SyslogAppender fail with NullPointerException

http://bugzilla.qos.ch/show_bug.cgi?id=147 Summary: ch.qos.logback.classic.net.SyslogAppender fail with NullPointerException Product: logback-classic Version: unspecified Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P1 Component: Other AssignedTo: logback-dev@qos.ch ReportedBy: rybin.andrey+logback@gmail.com Joran shows no error in conf file, but SyslogAppender failed with NullPointerException (because prefixLayout == null). I think Joran should show a error or SyslogAppender should work. conf, java and log below: conf: <?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> java: public static void main(String[] a) { org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(TestLogback.class); log.warn("test"); ch.qos.logback.classic.util.LoggerStatusPrinter.printStatusInDefaultContext(); }//main log: 11:09:10,687 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SyslogAppender] 11:09:10,687 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [aSYSLOG] 11:09:10,796 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [aSYSLOG] from the object stack 11:09:10,796 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to TRACE 11:09:10,796 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [aSYSLOG] to Logger[root] 11:09:10,796 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 11:09:10,796 |-ERROR in ch.qos.logback.classic.net.SyslogAppender[aSYSLOG] - Appender [aSYSLOG] failed to append. java.lang.NullPointerException java.lang.NullPointerException at ch.qos.logback.classic.net.SyslogAppender.postProcess(SyslogAppender.java:81) at ch.qos.logback.core.net.SyslogAppenderBase.append(SyslogAppenderBase.java:62) at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:81) at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51) at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:282) at ch.qos.logback.classic.Logger.callAppenders(Logger.java:266) at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:487) at ch.qos.logback.classic.Logger.filterAndLog(Logger.java:479) at ch.qos.logback.classic.Logger.warn(Logger.java:712) at net.sf.apr.test.logback.TestLogback.main(TestLogback.java:7) -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=147 noreply.ceki@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from noreply.ceki@qos.ch 2008-04-17 17:02 ------- Thank you for this report. The NullPointerException was indirectly caused by the layout option in your config file. SyslogAppender should not be given a layout but a "SuffixPattern" as explained in the docs [1]. Revision 1675 (see [2]), corrects this problem by not allowing the user to directly set a layout. The code also emits a warning with a reference to an explanation of the problem [3]. Please reopen this report if the problem persists. [1] http://logback.qos.ch/manual/appenders.html#SyslogAppender [2] http://svn.qos.ch/viewvc?view=rev&revision=1675 [3] http://logback.qos.ch/codes.html#syslog_layout -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
participants (1)
-
bugzilla-daemon@pixie.qos.ch