tags:

views:

655

answers:

2

I am looking for example configuration on how to get Log4net logging to a Syslog server. Any help would be welcome.

Thanks in advance.

+1  A: 

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
Chathuranga Chandrasekara
Thanks, I will investigate this, in .net we have the logging setup in config files... So I need to find some example configuration for .net for this...
JL
oops.. My bad. It is not for log4j not for log4net. I'll correct this
Chathuranga Chandrasekara
+2  A: 
<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>
JL
Just to complete this entry: Syslog (http://en.wikipedia.org/wiki/Syslog) uses a standard assigned UDP port 514
Peter Lillevold