Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 15793 invoked from network); 7 Jun 2007 01:53:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jun 2007 01:53:55 -0000 Received: (qmail 88767 invoked by uid 500); 7 Jun 2007 01:53:54 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 88247 invoked by uid 500); 7 Jun 2007 01:53:53 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 88235 invoked by uid 99); 7 Jun 2007 01:53:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2007 18:53:53 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [128.3.30.30] (HELO hpcrdm.lbl.gov) (128.3.30.30) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2007 18:53:49 -0700 Received: from localhost (localhost [127.0.0.1]) by hpcrdm.lbl.gov (Postfix) with ESMTP id 2D47670002992 for ; Wed, 6 Jun 2007 18:53:29 -0700 (PDT) Received: from hpcrdm.lbl.gov ([127.0.0.1]) by localhost (hpcrdm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16908-08 for ; Wed, 6 Jun 2007 18:53:27 -0700 (PDT) Received: from [192.168.0.10] (user-1087r2v.cable.mindspring.com [64.131.236.95]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by hpcrdm.lbl.gov (Postfix) with ESMTP id 42C3C70002AB8 for ; Wed, 6 Jun 2007 18:53:27 -0700 (PDT) Message-ID: <46676515.9000806@gridsphere.org> Date: Wed, 06 Jun 2007 21:53:25 -0400 From: Jason Novotny User-Agent: Thunderbird 1.5.0.12 (Macintosh/20070509) MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: commons-logging and log4j headaches References: <46675C6C.5080809@gridsphere.org> <7fc8f9070706061843n22e23b7red192afad44b69a@mail.gmail.com> In-Reply-To: <7fc8f9070706061843n22e23b7red192afad44b69a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hpcrdm.lbl.gov X-Virus-Checked: Checked by ClamAV on apache.org Hi Rodrigo, Thanks so much for the fast and accurate response! I'm not sure if putting the log4j.properties file in my application jar is such a great idea since it could cause weird things to happen if I distributed the jar as a library for others to use. But putting it in a conf directory seems like a good solution. Cheers, Jason Rodrigo Canabrava wrote: > Jason, > > you can't include a single properties file in the classpath with the > -cp option. It expects directories, or jar files. > You should put the properties file in some other directory (for > example conf), and put this directory in the classpath. A better > option is to put the log4j.properties file with your classes, inside > the build/lib/stockstats-1.0.jar. > > Rodrigo > > > 2007/6/6, Jason Novotny : >> >> Hi, >> >> I'm trying to use log4j and commons-logging in the simplest app and I >> get the infamous >> >> log4j:WARN No appenders could be found for logger >> (org.stockstats.tools.UpdateSymbols). >> log4j:WARN Please initialize the log4j system properly. >> >> In my classpath, I made sure I have commons-logging, log4j jars and my >> log4j.properties file as follows and I even turned on log4j debugging >> which claims that no log4j.properties file is found! >> >> >> [fuzzmonkey:~/StockStats] novotny% java -Dlog4j.debug -cp >> lib/log4j.properties:lib/commons-codec-1.3.jar:lib/commons-httpclient-3.1-rc1.jar:lib/commons-logging-1.0.4.jar:lib/log4j.properties:lib/log4j-1.2.11.jar:build/lib/stockstats-1.0.jar:. >> >> org.stockstats.tools.Main >> log4j: Trying to find [log4j.xml] using context classloader >> sun.misc.Launcher$AppClassLoader@a9c85c. >> log4j: Trying to find [log4j.xml] using >> sun.misc.Launcher$AppClassLoader@a9c85c class loader. >> log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). >> log4j: Trying to find [log4j.properties] using context classloader >> sun.misc.Launcher$AppClassLoader@a9c85c. >> log4j: Trying to find [log4j.properties] using >> sun.misc.Launcher$AppClassLoader@a9c85c class loader. >> log4j: Trying to find [log4j.properties] using >> ClassLoader.getSystemResource(). >> log4j: Could not find resource: [null]. >> log4j:WARN No appenders could be found for logger >> (org.stockstats.tools.UpdateSymbols). >> log4j:WARN Please initialize the log4j system properly. >> >> The only way I can get it to work is if I explicitly add >> -Dlog4configuration=file:///tmp/log4j.properties to specify the file >> location. I just cannot see why it can't find it in the classpath when I >> specified it explicitly. >> >> Thanks, Jason >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: commons-user-help@jakarta.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org