logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From theMonkyBoy <nabble....@vellosa.co.uk>
Subject Newbie – log4j and syslog-ng setup
Date Mon, 14 Aug 2006 13:13:24 GMT


sorry for this post, but I've been searching for a couple of days now and
found nothing to help me get started via google! 

In our environment we currently have a cluster of J2EE servers, where each
member writes to their own log file. Now we would like to also write to one
consolidated log file. So it has been envisaged that each cluster member
writes to their own syslog-ng deamon, who then in turn forwards messages on
to a central logging server.

I have a couple of problems here. Reading through the posts I have seen
people are using the SyslogAppender to get log4j to write to the syslog-nd
deamon. I have tried two configurations for this. 

<appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
	<param name="SyslogHost" value=""/>
	<param name="Facility" value="USER"/>
	<param name="FacilityPrinting" value="true"/>
	<layout class="org.apache.log4j.PatternLayout">
		<param name="ConversionPattern" value="%p: %c - %m"/>


log4j.appender.SYSLOG.layout.ConversionPattern=%p: %c - %m

I then try to use a very simple program to print to this appender: 

package com.foo.bar;

import org.apache.log4j.Logger;

public class LogStuff
  Logger log = Logger.getLogger( LogStuff.class );
  public static void main(String [] argv)
    new LogStuff().doIt();
  private void doIt()
    log.debug( "Hello world!" );
    log.info( "Hello world!" );
    log.warn( "Hello world!" );
    log.error( "Hello world!" );
    log.fatal( "Hello world!" );

When I then check the syslog-ng files I find nothing in there. So I guess
there is some configuration to do on that side. 

So I started to hack the syslog-ng.conf file.

source s_j2ee { unix-stream("/dev/log"); internal(); };
destination d_j2ee { file("/var/log/j2ee.log"); };
log { source(s_j2ee); destination(d_j2ee); };

As some of the internal syslog-ng messages are arriving in my log file I
assume that some of this configuration is correct. However, as no java
messages are being received I assume that I've not set up the source

Through all my searched I was unable to find the source that log4j will use.
Can someone point me in the right direction? 

Are there any good resources available that I can read? 

Thanks in advance for your help 

View this message in context: http://www.nabble.com/Newbie--log4j-and-syslog-ng-setup-tf2103256.html#a5796385
Sent from the Log4j - Users forum at Nabble.com.

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message