Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 4373 invoked from network); 14 Aug 2008 19:25:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Aug 2008 19:25:07 -0000 Received: (qmail 68537 invoked by uid 500); 14 Aug 2008 19:25:00 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 68511 invoked by uid 500); 14 Aug 2008 19:25:00 -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 68500 invoked by uid 99); 14 Aug 2008 19:24:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2008 12:24:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of hoju@visi.com designates 208.42.176.221 as permitted sender) Received: from [208.42.176.221] (HELO g2host.com) (208.42.176.221) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2008 19:24:03 +0000 Received: from [162.136.192.1] (account hoju@visi.com) by mailback2.g2host.com (CommuniGate Pro WEBUSER 5.1.16) with HTTP id 10565323 for log4j-user@logging.apache.org; Thu, 14 Aug 2008 14:24:23 -0500 From: "Jacob Kjome" Subject: Re: strange behavior of my log4j.xml configuration To: "Log4J Users List" X-Mailer: CommuniGate Pro WebUser v5.1.16 Date: Thu, 14 Aug 2008 14:24:23 -0500 Message-ID: In-Reply-To: <507606.13115.qm@web62508.mail.re1.yahoo.com> References: <507606.13115.qm@web62508.mail.re1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1;format="flowed" Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On Wed, 13 Aug 2008 19:25:03 -0700 (PDT) lanes wrote: > Hi Jake, > >First thanks for your quick reply. > > What do you mean ensuring each application will use their own respective >configuration? > Is it by reconfigure it using DOMConfigure / PropertyConfigurator explicitly >inside each application? > Whether you manually configure using DOM or Property Confgurator or let Log4j auto-configure itself is irrelevant to whether each application will use its own respective configuration.� In the simple case, where no custom logger repository selector has been defined, it's all about classloader visibility and behavior. If you use standard Java parent-first classloading behavior, then if an instance of log4j exists in a parent classloader that both app1 and app2 can see, then they will both use that instance of Log4j.� This instance of log4j will attempt to auto-configure itself upon the first loading of LogManager.class (triggered by any Logger.getLogger("somename") statement).� Usually one would put log4j.xml in the classpath alongside log4j.jar in the same parent classloader so that Log4j can see the configuration, allowing auto-configuration to succeed.� The point about manual configuration is that if you have multiple apps performing it, you will not only be overriding the default configuration but also changing for the configuration for a shared logger repository.� Each app that reconfigures will affect all apps sharing that logger repository. > After read your URL about logger repository, i'm quite surprise that the >first line in the URL says : > "Log4j, by default, uses a single logger repository. So, unless you log > within the context of your own custom logger repository, the last > entity to configure Log4j will have configured Log4j for every app > using the default logger repository." > > well, that's why other application's configurations also affected after i >configure my log4j inside my application. > Yep.� This is fundamental to understand when using log4j (or any logging utility, for that matter). Jake > Thanks for your reply. > > Regards, > Lanes > > > --- On Wed, 8/13/08, Jacob Kjome wrote: >From: Jacob Kjome > Subject: Re: strange behavior of my log4j.xml configuration > To: "Log4J Users List" > Date: Wednesday, August 13, 2008, 9:46 PM > > Unless you've taken steps to ensure that each application will log using > their > own instance of log4j or use a Logger Repository Selector that >distinguishes, > somehow, between applications, then all apps will use the same Logger > Repository (the default one) from a single instance of Log4j. > > Most application servers don't use child-first, or parent-last, > classloading > for webapps by default.� Tomcat Standalone is one of the only ones out there > that does this by default.� Hence, it is usually quite simple to separate > logging per/application under Tomcat.� Other appservers may have options to > use child-first classloading.� However, many times you'll run into other > issues because it's not well supported on other platforms. > > I presume each app is manually configuring iteself?� For appservers like > Weblogic of Websphere, I suggest you put both log4j.jar and log4j.xml in the > server classpath and get rid of manual configuration code in your apps. > > If you want to explore true logging separation and be able to continue to > manually configure without affecting other apps, then you can look into >using > a repository selector.� However, the concept is confusing for many and may >be > more effort than it is worth.� I'll let you decide... > > http://wiki.apache.org/logging-log4j/AppContainerLogging > > > Jake > > On Wed, 13 Aug 2008 03:50:09 -0700 (PDT) > lanes wrote: >> Hi All, >> >> I got a strange behavior when i deploy my application >> that define the log4j.xml configuration to existing App.Server (say it >> IBM WAS v6.1) then other application's log that already use their own >> log file for example App A log to A.log, App B log to B.log will >> suddenly redirect to SystemOut.log and no longer to their respective >> logs file. >> >> But when i undeploy my application from the App Server, then other >>application's log file come back to normal. >> >> Below is my log4j.xml configuration : >> >> >> >> >> xmlns:log4j="http://jakarta.apache.org/log4j/"> >> >> ��� >> ��� > class="org.apache.log4j.ConsoleAppender"> >> ������� value="'.'yyyy-MM-dd"/> >> ������� value="true"/> >> ������� value="debug"/> >> ������� value="System.out" /> >> ������� class="org.apache.log4j.PatternLayout"> >> ����������� value="%-5p:%d:%c{1} [%x] - >>%m%n" /> >> ������� >> ��� >> >> ��� >class="org.apache.log4j.DailyRollingFileAppender"> >> ������� > value="my_file_a_log.log"/> >> ������� value="'.'yyyy-MM-dd"/> >> ������� value="true"/> >> ������� value="debug"/> >> ��� ��� class="org.apache.log4j.PatternLayout"> >> ��� ��� ��� value="%-5p:%d:%c{1} [%x] - >>%m%n" /> >> ��� ��� >> ��� >> >> ��� additivity="false"> >> ��� ��� >> ������� >> ��� >> >> ��� >> >> ��� ��� >> ��� ��� >> ��� >> >> >> >> Is it correct? >> Am i missing something? >> >> My other question is why other application is affected to my log4j.xml >>configuration? >> I though every application inside the App.Server will have their own >>respective configuration? >> >> Please help me. >> your help is really appreciated. >> >> regards, >> Lanes >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >For additional commands, e-mail: log4j-user-help@logging.apache.org > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org