You only showed your appender config.  Are you use the messages are
getting to the appender.

If you run with -Dlog4j.debug it might give you helpful info.

On 8/14/06, theMonkyBoy <[EMAIL PROTECTED]> wrote:

Hi,

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="127.0.0.1"/>
        <param name="Facility" value="USER"/>
        <param name="FacilityPrinting" value="true"/>
        <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%p: %c - %m"/>
        </layout>
</appender>

and:

log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.syslogHost=127.0.0.1
log4j.appender.SYSLOG.Facility=USER
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
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
correctly.

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to