From log4j-user-return-24479-apmail-logging-log4j-user-archive=logging.apache.org@logging.apache.org Thu Jun 7 08:27:09 2012 Return-Path: X-Original-To: apmail-logging-log4j-user-archive@www.apache.org Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 189409271 for ; Thu, 7 Jun 2012 08:27:09 +0000 (UTC) Received: (qmail 82385 invoked by uid 500); 7 Jun 2012 08:27:08 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 81801 invoked by uid 500); 7 Jun 2012 08:27:05 -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 81711 invoked by uid 99); 7 Jun 2012 08:27:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 08:27:02 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FSL_RCVD_USER,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [85.218.33.219] (HELO pixie.qos.ch) (85.218.33.219) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 08:26:53 +0000 Received: by pixie.qos.ch (Postfix, from userid 2207) id 0868D46316B; Thu, 7 Jun 2012 10:27:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on pixie X-Spam-Level: Received: from [192.168.1.44] (179-91.195-178.cust.bluewin.ch [178.195.91.179]) by pixie.qos.ch (Postfix) with ESMTPSA id 5088745BA49 for ; Thu, 7 Jun 2012 10:27:48 +0200 (CEST) Message-ID: <4FD065AD.5080804@qos.ch> Date: Thu, 07 Jun 2012 10:26:21 +0200 From: ceki User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Log4J Users List Subject: Re: slf4j, log4j and PropertyConfigurator.configure References: <776E2BF2-832C-45F2-93EB-9B8F2460824B@locationary.com> In-Reply-To: <776E2BF2-832C-45F2-93EB-9B8F2460824B@locationary.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Old-Spam-Status: No, score=-2.9 required=5.7 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Hello Jeff, From the messages log4j outputs at configuration time, it very much looks like the root logger is defined twice with the second definition with no appender. Hence the "log4j:WARN No appenders could be found for logger (com.loca.util.services.AppListener)" message. HTH, -- Ceki http://twitter.com/#!/ceki On 07.06.2012 00:26, Jeff Sawatzky wrote: > I have a project where I am using slf4j with the log4j binder, and I > am trying to configure log4j with the PropertyConfigurator. The > project allows for a common log4.properties file and a machine > log4j.properties file, and at start up I load the two files, combine > them into a Properties object, and then pass them to > PropertyConfigurator.configure. But when I try to log using slf4j I > get a "log4j:WARN No appenders could be found for logger" error on the > class I am trying to log from. > > In my app startup I have.. > > Properties props = //do work....... > LogManager.resetConfiguration(); > PropertyConfigurator.configure(props); > > but here is the output (with log4j.debug turned on) > log4j: Parsing for [root] with value=[INFO, stdout]. > log4j: Level token is [INFO]. > log4j: Category root set to INFO > log4j: Parsing appender named "stdout". > log4j: Parsing layout options for "stdout". > log4j: Setting property [conversionPattern] to [%-4r [%t] %-5p %c %x - %m%n]. > log4j: End of parsing for "stdout". > log4j: Parsed "stdout" options. > log4j: Finished configuring. > log4j: Parsing for [root] with value=[INFO]. > log4j: Level token is [INFO]. > log4j: Category root set to INFO > log4j: Finished configuring. > log4j:WARN No appenders could be found for logger (com.loca.util.services.AppListener). > log4j:WARN Please initialize the log4j system properly. > log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. > > Shouldn't the logger for com.loca.util.services.AppListener use the root appender that was configured? > > Thanks! --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org