[logback-user] syslogappender stacktraces get cut

Thorbjørn Ravn Andersen thunderaxiom at hotmail.com
Tue Mar 20 14:08:32 CET 2012


I understand your concerns.

 

An option you may want to consider, is to consider logback is being released
much more frequently than log4j and simply work with Ceki to have your needs
addressed in a new release.      The odds of this is best if you can provide
actual, working code based on cloning  <https://github.com/ceki/logback>
https://github.com/ceki/logback.

 

Best regards,

/Thorbjørn

 

 

From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On
Behalf Of Ingebrigt Berg
Sent: 20. marts 2012 12:03
To: logback-user at qos.ch
Subject: [logback-user] syslogappender stacktraces get cut

 

Hi !

We've recently made the switch from Log4j to Logback. We use Syslog to send
logfiles to our logserver, and things generally work.

But when there are stacktraces in the logs we get in trouble. SyslogAppender
will replace lineshifts with '#011' to make the logentry a single line. Then
it will cut each line that is to long according to the syslog limit of
2K/line. Only the fist segment will arrive in the correct log. The remaining
segments do not contain everything in the suffixPattern, and our regexp will
not have anything to match. The segment will end up in a 'trash' log for
unmatchable loglines.

My config for the SyslogAppender looks like this:

    <contextName>company-${CONTEXT_PATH}-${environment}</contextName>
    <appender name="LOGSERVER_FILE"
class="ch.qos.logback.classic.net.SyslogAppender">
        <syslogHost>localhost</syslogHost>
        <facility>local3</facility>
        <SuffixPattern>%contextName %d{dd.MM.yyyy HH:mm:ss.SSS} [%p] [%c{1}]
[%X{ThreadId}]: %m%n</SuffixPattern>
    </appender>

We use the contextName property to control the logfilename. On the receiving
end we read the contextName parameter (using a regexp) for each log line,
and write the line to a file with a corresponding name.

We had a similar problem when we used Log4J (Where the Tag element was used
in the same manner), and fixed it back then by writing a custom log4j
SyslogAppender. But the main purpose of moving to Logback is to loose all
our home brew logging stuff, we don't want to go down that path again. If we
can't make Logback work out of the box with Syslog we'll probably end up
going back to Log4J. (Another alternative is to replace Syslog with Gelf,
but that's further down the road).

However, I imagine Logback and Syslog being a common combination, and surely
someone must have this working out of the box. Any advice will be
appreciated. My requirements are simple:
-must work with no custom logging code, only config (preferably xml)
-stacktraces in logs must work
-must be able to fully control the filename on the recieving end.

cheers,
Ingebrigt Berg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120320/d79d81b0/attachment.html>


More information about the Logback-user mailing list