Bug 40161

Summary: SysLogAppender is not logging header of the layout
Product: Log4j - Now in Jira Reporter: Aparna <aparna.mokkapati>
Component: AppenderAssignee: log4j-dev <log4j-dev>
Status: RESOLVED FIXED    
Severity: critical CC: grandhisiri
Priority: P1    
Version: 1.2   
Target Milestone: ---   
Hardware: Other   
OS: Windows XP   

Description Aparna 2006-08-02 10:43:05 UTC
Hi Log4j-Dev,

Bug Description:
I am using SyslogAppender to redirect the application specific logs to Unix
Syslog but I am unable to find the Header of the Custom layout in 
Syslogs.Currently I am using log4j 1.2.8

Observation:
When I observe other appenders they are extending WriteAppender class which 
has writeHeader() funtion to log the Header.But I found that this functionality
is missing in SyslogAppender.

So when I simply use the SyslogAppender with the extra function WriteHeader()
and just append to the writerlayout.getHeader().I am able to log the header

I have seen that this funtionality is even missing in log4j 1.2.13.


If I am not wrong Can you please let me know whether there is any possibility 
of logging the header information with the existing verison(Currently I am 
using log4j 1.2.8.) or When can I get the required funtionality in log4j 
builds because my application is unabling the cilents to configure the logs

Waiting to find the fix in log4j builds soon


Thanks and Regards,
Aparna
Comment 1 Curt Arnold 2006-08-31 05:30:58 UTC
Do you think that the layout header should be written once at the appender initialization, once at the first 
processed log request or once per log request?

Should the footer be written once when the appender is closed or once per log request?
Comment 2 Aparna 2006-09-01 12:29:08 UTC
SyslogAppender should be similar to other appenders in logging the header
and footer.So I think that header should be logged once at the first 
processed log request and footer once when the appender is closed.

In case of reloading(change)the properties or config file,Logging of headers 
and footers should be similar to other appenders 

Comment 3 Elias Ross 2007-01-27 23:17:32 UTC
SysLogAppender now is a subclass of WriterAppender and behaves the same as other
appenders writing the footer and header at activation and closing.

This is checked into SVN trunk, pending for 1.3
Comment 4 Curt Arnold 2007-01-30 14:44:00 UTC
Committed by Elias against log4j/trunk in rev 500749.

Changing the base class of an established appender is a pretty significant architectural change for such a 
small enhancement and would have benefitted from prior discussion.  I would be very reluctant to make 
such a change in log4j 1.2.x and the 1.3 patch should be reviewed.  I think it is likely that the rebasing of 
the class may have introduced behavioral changes (buffering, encoding, etc) in addition to the desired 
change.
Comment 5 Curt Arnold 2007-02-22 14:37:10 UTC
Committed minor tweak to SyslogAppender in log4j 1.2 branch on rev 510695 to address this issue.  
Header will be emitted on either call to activateOptions() or first handled logging event, footer will be sent 
on close if initialization got to either of those points.