Bug 50085 - SyslogAppender does not split stack traces correctly
SyslogAppender does not split stack traces correctly
Status: NEW
Product: Log4j
Classification: Unclassified
Component: Appender
1.2
PC Linux
: P2 major
: ---
Assigned To: log4j-dev
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-10-13 08:10 UTC by dimo.velev
Modified: 2010-10-13 08:10 UTC (History)
0 users



Attachments

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:
--cut--
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)
--cut--
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.