Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 40656 invoked from network); 2 Apr 2006 15:58:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Apr 2006 15:58:12 -0000 Received: (qmail 35823 invoked by uid 500); 2 Apr 2006 15:58:05 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 35728 invoked by uid 500); 2 Apr 2006 15:58:04 -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 35716 invoked by uid 99); 2 Apr 2006 15:58:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Apr 2006 08:58:04 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=INFO_TLD,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 204.127.200.82 is neither permitted nor denied by domain of hoju@visi.com) Received: from [204.127.200.82] (HELO sccrmhc12.comcast.net) (204.127.200.82) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Apr 2006 08:58:03 -0700 Received: from nicki.visi.com (c-66-41-141-26.hsd1.mn.comcast.net[66.41.141.26]) by comcast.net (sccrmhc12) with SMTP id <20060402155742012007n35le>; Sun, 2 Apr 2006 15:57:42 +0000 Message-Id: <7.0.1.0.0.20060402105357.0490ce50@visi.com> X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Date: Sun, 02 Apr 2006 10:57:41 -0500 To: "Log4J Users List" From: Jacob Kjome Subject: Re: odd Initialization issues. In-Reply-To: <20060402082516.79813.qmail@web51302.mail.yahoo.com> References: <20060402082516.79813.qmail@web51302.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Relayed-By: GPGrelay Version 0.959 (Win32) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 2 things: 1. You should *always* define the root logger, such as... log4j.rootLogger=WARN, SomeAppender 2. Your other loggers need to be prefixed by "log4j.logger.", such as... log4j.logger.tb.test=DEBUG, SO1, RF1 log4j.logger.org.apache.commons.httpclient.wire=WARN, SO1, RF1 Jake At 04:25 AM 4/2/2006, you wrote: >Usually putting log4j.properties in the classpath is enough to >properly initialize it. In this case, even though log4j.properties is >provably in my classpath, it's not initializing correctly. > > > > Here is the code: > > package tb.test; > > import org.apache.log4j.Logger; > import java.io.File; > > public class SimpleInit { > > private static final Logger logger = Logger.getLogger(SimpleInit.class); > > public static void main(String[] args) throws Exception { > String log4jfile = "log4j.properties"; > File l = new File(log4jfile); > > // this proves log4j.properties is in the path > System.out.println("Simple: " + log4jfile + " exists: " + l.exists()); > //org.apache.log4j.BasicConfigurator.configure(); > logger.info("Ahoy"); > } > } > > > > Here is the output: > Simple: log4j.properties exists: true > log4j:WARN No appenders could be found for logger (tb.test.SimpleInit). > log4j:WARN Please initialize the log4j system properly. > > > > Here is the log4j.properties: > > tb.test=DEBUG, SO1, RF1 > httpclient.wire=WARN, SO1, RF1 > > # SO1 appender > log4j.appender.SO1=org.apache.log4j.ConsoleAppender > log4j.appender.SO1.layout=org.apache.log4j.PatternLayout > log4j.appender.SO1.layout.ConversionPattern=%d{HH:mm:ss} [%16.16t] >[%X{stbip}] %-5p [%-6L:%-22.22c{1}] - %m%n > log4j.appender.SO1.threshold=INFO > > #RF1 appender > log4j.appender.RF1=org.apache.log4j.RollingFileAppender > log4j.appender.RF1.File=log/test.log > log4j.appender.RF1.MaxFileSize=10000KB > log4j.appender.RF1.MaxBackupIndex=9 > log4j.appender.RF1.Append=false > log4j.appender.RF1.layout=org.apache.log4j.PatternLayout > #log4j.appender.RF1.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %-5p >[%t] [%X{stbip}] [%C{1} (%L)]: %m%n > log4j.appender.RF1.layout.ConversionPattern=%d{dd MMM HH:mm:ss} >[%16.16t] [%X{stbip}] %-5p [%-6L:%-22.22c{1}] - %m%n > > > > Any suggestions appreciated! > > Thanks! > > > -Travis > > > >--------------------------------- >How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates. --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org