I am looking for example configuration on how to get Log4net logging to a Syslog server. Any help would be welcome.
Thanks in advance.
I am looking for example configuration on how to get Log4net logging to a Syslog server. Any help would be welcome.
Thanks in advance.
I think you need to use SocketAppender and send the messages to syslog server. Configure your log4j configuration XML file to use the SocketAppender as an appender.
Sample format
log4j.appender.socketLogger=org.apache.log4j.net.SocketAppender
log4j.appender.socketLogger.RemoteHost=localhost
log4j.appender.socketLogger.Port=4445
log4j.appender.socketLogger.LocationInfo=false
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
<param name="RemoteAddress" value="127.0.0.1" />
<param name="RemotePort" value="514" />
<layout type="log4net.Layout.PatternLayout, log4net">
<conversionPattern value="%-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>