Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 35219 invoked from network); 14 Aug 2006 15:33:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Aug 2006 15:33:31 -0000 Received: (qmail 67808 invoked by uid 500); 14 Aug 2006 15:33:26 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 67321 invoked by uid 500); 14 Aug 2006 15:33:24 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 67310 invoked by uid 99); 14 Aug 2006 15:33:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2006 08:33:24 -0700 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=DNS_FROM_RFC_ABUSE,INFO_TLD,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of stauffer.james@gmail.com designates 64.233.184.226 as permitted sender) Received: from [64.233.184.226] (HELO wr-out-0506.google.com) (64.233.184.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2006 08:33:22 -0700 Received: by wr-out-0506.google.com with SMTP id 68so86957wri for ; Mon, 14 Aug 2006 08:33:02 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=g1vFpuRukrS+sAhDrBClm79P56mpoc4h66wd+HaCDVOr3m8zFqNeyJzNZoZdqRvtoenKPmDcJOI21h2PyvzVMliyaNWZyTRJiV0380J0mYXGpSKZ51FcsXwb8jLIvhMRO4YXToaBjezLXNCcCkFIHdEq8ETxXn7Fd26+LEJzvG4= Received: by 10.78.166.7 with SMTP id o7mr3293556hue; Mon, 14 Aug 2006 08:33:01 -0700 (PDT) Received: by 10.78.166.16 with HTTP; Mon, 14 Aug 2006 08:33:01 -0700 (PDT) Message-ID: Date: Mon, 14 Aug 2006 10:33:01 -0500 From: "James Stauffer" To: "Log4J Users List" Subject: =?WINDOWS-1252?Q?Re:_Newbie_=96_log4j_and_syslog-ng_setup?= In-Reply-To: <5798352.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5796385.post@talk.nabble.com> <5798352.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Ok then I don't have any more advice because I hadn't used that appender. On 8/14/06, theMonkyBoy wrote: > > Hi James, > > Thanks for your reply. > > > James Stauffer wrote: > > > > You only showed your appender config. Are you use the messages are > > getting to the appender. > > > > > Here is my complete log4j.xml configuration file: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I am getting messages to the console and also in the log file, so I am > assuming that the log4j config is working and therefore something on the > syslog-ng side isn't configured as it should be. > > > > > James Stauffer wrote: > > > > If you run with -Dlog4j.debug it might give you helpful info. > > > > Thanks for the debug tip, I was completely unaware of that one. This is the > console output when running with the debug flag set. As you can see at the > end my log4j messages are output: > > log4j: Trying to find [log4j.xml] using context classloader > sun.misc.Launcher$AppClassLoader@136228. > log4j: Using URL [file:/cc.project/log4j/target/classes/log4j.xml] for > automatic log4j configuration. > log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator > log4j: System property is :null > log4j: Standard DocumentBuilderFactory search succeded. > log4j: DocumentBuilderFactory is: > org.apache.crimson.jaxp.DocumentBuilderFactoryImpl > log4j: debug attribute= "null". > log4j: Ignoring debug attribute. > log4j: Threshold ="null". > log4j: Level value for root is [debug]. > log4j: root level set to DEBUG > log4j: Class name: [org.apache.log4j.ConsoleAppender] > log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" > log4j: Setting property [conversionPattern] to [%d [%t] %-5p %c %x - %m%n]. > log4j: Adding appender named [STDOUT] to category [root]. > log4j: Class name: [org.apache.log4j.FileAppender] > log4j: Setting property [file] to [/tmp/log4j-syslog.log]. > log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" > log4j: Setting property [conversionPattern] to [%d [%t] %-5p %c %x - %m%n]. > log4j: setFile called: /tmp/log4j-syslog.log, true > log4j: setFile ended > log4j: Adding appender named [LOGFILE] to category [root]. > log4j: Class name: [org.apache.log4j.net.SyslogAppender] > log4j: Setting property [syslogHost] to [localhost]. > log4j: Setting property [facility] to [USER]. > log4j: Setting property [facilityPrinting] to [true]. > log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" > log4j: Setting property [conversionPattern] to [%p: %c - %m]. > log4j: Adding appender named [SYSLOG] to category [root]. > 2006-08-14 17:18:04,574 [main] DEBUG ch.cablecom.log4j.LogStuff - Hello > world! > 2006-08-14 17:18:04,577 [main] INFO ch.cablecom.log4j.LogStuff - Hello > world! > 2006-08-14 17:18:04,578 [main] WARN ch.cablecom.log4j.LogStuff - Hello > world! > 2006-08-14 17:18:04,578 [main] ERROR ch.cablecom.log4j.LogStuff - Hello > world! > 2006-08-14 17:18:04,578 [main] FATAL ch.cablecom.log4j.LogStuff - Hello > world! > > > > > > James Stauffer wrote: > > > > On 8/14/06, theMonkyBoy 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. > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> 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: log4j-user-unsubscribe@logging.apache.org > >> For additional commands, e-mail: log4j-user-help@logging.apache.org > >> > >> > > > > > > -- > > James Stauffer > > Are you good? Take the test at http://www.livingwaters.com/good/ > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > > For additional commands, e-mail: log4j-user-help@logging.apache.org > > > > > > > > -- > View this message in context: http://www.nabble.com/Newbie--log4j-and-syslog-ng-setup-tf2103256.html#a5798352 > 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 > > -- James Stauffer Are you good? Take the test at http://www.livingwaters.com/good/ --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org