The current implementation of the SyslogAppender uses udp only to send log messages to a syslog (syslog-ng) daemon. Therefore the syslog-ng has to be enabled to accept udp. I got it working with the following configuration.
Example Configuration Snippets:
Snippet of syslog-ng.conf
source src {
# # your other config #
udp(ip("127.0.0.1") port(514));
}
Snippet of log4jConfig.xml:
....
<appender name="syslog" class="org.apache.log4j.net.SyslogAppender">
<param name="SyslogHost" value="127.0.0.1"/> <param name="Facility" value="USER"/> <param name="FacilityPrinting" value="true"/> <layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%t %5r %-5p %-21d{yyyyMMdd HH:mm:ss,SSS} %c{2} [%x] %m %n"/>
</layout>
</appender>