Log4j SyslogAppender not attempting a connection
I have an application that uses log4j to write log files. I don't have
access to the source code, but I can assume that if I create an appender
in the log4j.xml file that it should use that appender without needing a
code change.
Currently I can confirm that no packets are being generated from the
system to the remote syslog server via wireshark. I can telnet to the
remote syslog server on port 514 and write messages without an issue. I
can assume that something isn't right with my XML, but I have no messages
to tell me what the error is.
Here's the Appender:
<appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
<param name="Facility" value="USER" />
<param name="syslogHost" value="172.16.81.39:514" />
<param name="Threshold" value="INFO" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy/MM/dd
HH:mm:ss.SSS}][%5p](%t) %m%n" />
</layout>
</appender>
I have also tried the Log4j 2 syntax
<appender name="syslog" class="org.apache.log4j.net.SyslogAppender">
<param name="format" value="bsd" />
<param name="host" value="172.16.81.39" />
<param name="port" value="514" />
<param name="protocol" value="TCP" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy/MM/dd
HH:mm:ss.SSS}][%5p](%t) %m%n" />
</layout>
</appender>
Here's the corresponding Logger:
<logger name="printing.com.application" additivity="false">
<level value="INFO" />
<appender-ref ref="SYSLOG" />
</logger>
If I change the <appender-ref /> to the default PRINTING_MONTHLY_ROLL then
it will print to the log file.
No comments:
Post a Comment