[logback-user] SyslogAppender not logging Throwable message

Steve Davis stev3zilla at yahoo.com
Thu Mar 17 23:13:26 CET 2011


Gustav,

I had the same problem, and seemingly solved it by adding  %ex{full} to my 
appender's suffixPattern.  E.g.:

  <appender name="SYSLOG-DEFAULT" 
class="ch.qos.logback.classic.net.SyslogAppender">
    <syslogHost>localhost</syslogHost>
    <facility>USER</facility>
    <suffixPattern>[%thread] %logger %msg%n%ex{full}</suffixPattern>
  </appender>

Now, I'm still getting some extraneous syslog entries with the individual stack 
frames, in addition to those in the first syslog message, but that at least 
gives me something to work with:

  Mar 17 18:04:23.139 Mar 17 18:04:23.000 myhost user.err  
logtest.foo.bar.FooBar Exception caught... 

  java.lang.Exception: This is a fake Exception
          at logtest.foo.bar.FooBar.spew(FooBar.java:28)
          at logtest.LogTest.main(LogTest.java:43)
  Caused by: java.lang.RuntimeException: This is a fake RuntimeException
          at logtest.foo.bar.FooBar.spew(FooBar.java:27)
          ... 1 common frames omitted
  Mar 17 18:04:23.139 myhost user.err    at 
logtest.foo.bar.FooBar.spew(FooBar.java:28)
  Mar 17 18:04:23.139 myhost user.err    at 
logtest.LogTest.main(LogTest.java:43)
  Mar 17 18:04:23.139 myhost user.err    at 
logtest.foo.bar.FooBar.spew(FooBar.java:27)
  Mar 17 18:04:23.139 myhost user.err    at 
logtest.LogTest.main(LogTest.java:43)

"Exception caught..." was the String that I supplied in the logger.error call.  
I'm not sure how to get rid of the extraneous syslog entries after the main one, 
or why %ex{full} still result in "1 common frames omitted"... any suggestions 
out there?  I'm still a logback newbie, but liking it, so far.

Regards,
Steve
--


On Feb 4 at 14:30:18 2011, Gustav Karlsson wrote:
>
> Hi, 
> 
> We are using the SyslogAppender in logback 0.9.27 and are having
> an issue with the logging of Throwables.  
>
> When we are logging an entry like LOG.debug("My message", throwable),
> "My message" and the throwable's stacktrace is appended to the log,
> but not the throwable's message. Has anyone else experienced this and
> know the cause?
>
> Regards,
> Gustav



      


More information about the Logback-user mailing list