Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 67616D843 for ; Mon, 17 Sep 2012 16:32:06 +0000 (UTC) Received: (qmail 14375 invoked by uid 500); 17 Sep 2012 16:32:02 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 14167 invoked by uid 500); 17 Sep 2012 16:32:02 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 14158 invoked by uid 99); 17 Sep 2012 16:32:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Sep 2012 16:32:02 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.62.80] (HELO qmta08.westchester.pa.mail.comcast.net) (76.96.62.80) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Sep 2012 16:31:56 +0000 Received: from omta16.westchester.pa.mail.comcast.net ([76.96.62.88]) by qmta08.westchester.pa.mail.comcast.net with comcast id 0Fex1k0041uE5Es58GXeJK; Mon, 17 Sep 2012 16:31:38 +0000 Received: from Christophers-MacBook-Pro.local ([69.143.109.145]) by omta16.westchester.pa.mail.comcast.net with comcast id 0GXl1k00i38FjT13cGXmmF; Mon, 17 Sep 2012 16:31:47 +0000 Message-ID: <50575063.9080504@christopherschultz.net> Date: Mon, 17 Sep 2012 12:31:31 -0400 From: Christopher Schultz User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Problem with using log4j Tomcat and web application level References: In-Reply-To: X-Enigmail-Version: 1.4.4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Izolda, On 9/16/12 6:19 AM, Kiss Izolda wrote: > I have configured Tomcat to use log4j according to > http://tomcat.apache.org/tomcat-7.0-doc/logging.html I have used > the same log4j.properties. My web application is using log4j as > well. There is no log4j.jar in WEB-INF/lib. You need to put one in there if you want application-level logging to work the way you expect. > How can I prevent Tomcat from using the web application's root > logger? Tomcat will not use the web application's logger if you configure the two logging systems separately. You need: - - log4j.jar in CATALINA_BASE/lib (for Tomcat's logging) - - log4j.xml in CATALINA_BASE/lib (for Tomcat's logging config) - - log4j.jar in webapp's WEB-INF/lib (for app logging) - - log4j.xml in webapp's WEB-INF/lib (for app logging config) Also, remember that you have to trigger a configuration operation before you try to use the logger in your webapp, so make sure you do that. I'm not sure how to trigger an XML configuration, but for a property-file-based config, you just have to instantiate a new "PropertyConfigurator" object. You can probably do something similar for an XML-based configuration. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBXUGMACgkQ9CaO5/Lv0PCHbwCgi3OM1T1yZlQQdEktcV1+q3Zw gb4AoKDupX+E2n9YxZq9OnaEdhAE9HiE =2csn -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org