Bug 50085 - SyslogAppender does not split stack traces correctly
Summary: SyslogAppender does not split stack traces correctly
Status: NEW
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Appender (show other bugs)
Version: 1.2
Hardware: PC Linux
: P2 major
Target Milestone: ---
Assignee: log4j-dev
Depends on:
Reported: 2010-10-13 08:10 UTC by dimo.velev
Modified: 2010-10-13 08:10 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description dimo.velev 2010-10-13 08:10:15 UTC
The SyslogAppender does not seem to handle the stack traces correctly. The symptoms are strange looking log files created by syslog. An example:
2010-10-13T13:42:14+02:00 the.correct.hostname.com stdout WARN  [http-8080-1] a.b.c.d:
2010-10-13T13:42:14+02:00 the.correct.hostname.com java.lang.NullPointerException
2010-10-13T13:42:14+02:00 localhost.localdomain the.correct.hostname.com    at a.b.c.d.e.f.G.h(G.java:672)
2010-10-13T13:42:14+02:00 localhost.localdomain the.correct.hostname.com    at a.b.c.d.e.f.G.h(G.java:852)
The hostname of the first two log entries seems okay but the next ones (the stacktrace) use localhost.localdomain which is wrong.

I guess the problem is in SyslogAppender.append which seems to handle the layout message and the stack trace differently (the former going through splitPacket, the latter going directly to sqw). I am not sure but it seems to me that we need to first create the whole payload (including the stacktrace) and then send it using splitPacket.