Bug 50085

Summary: SyslogAppender does not split stack traces correctly
Product: Log4j - Now in Jira Reporter: dimo.velev
Component: AppenderAssignee: log4j-dev <log4j-dev>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

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.