Return-Path: Mailing-List: contact log4j-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list log4j-user@jakarta.apache.org Received: (qmail 89301 invoked from network); 1 Mar 2001 18:10:31 -0000 Received: from platypus.webeasy.com (206.83.177.10) by h31.sny.collab.net with SMTP; 1 Mar 2001 18:10:31 -0000 Received: (qmail 586 invoked from network); 1 Mar 2001 18:10:00 -0000 Received: from tundra.webeasy.com (HELO protos.lifesci.ucla.edu) (207.155.5.35) by platypus.webeasy.com with SMTP; 1 Mar 2001 18:10:00 -0000 Message-ID: <3A9E909E.6CD81388@protos.lifesci.ucla.edu> Date: Thu, 01 Mar 2001 10:10:38 -0800 From: John Carnahan X-Mailer: Mozilla 4.72 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: LOG4J Users Mailing List Subject: Re: Difference in using BasicConfigurator v.s. DOMCOnfigurator References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Jim, Why not have log4j.properties and log4j.xml as defaults and simply state some contract about precedence? This (I think) would be simpler for most people if the config, regardless of type (props v. xml), would just be found in the classpath. John Jim Moore wrote: > The log4j.configuration property is to provide a configuration file other > than the default. The default is log4j.properties (anything else is not the > default). So if you want it to use something other than the default, you > have to provide that property. BasicConfigurator then takes a guess at > whether to use PropertyConfigurator or DOMConfigurator based upon the > extension of the file. > > log4j.configuration expects a URL. When using the PropertyConfigurator you > can leave out the protocol (the "file:" part), but not with DOMConfigurator > (or at least that's how it is in 1.04). I don't know why -- I just know if > I include the "file:" it works and if I leave it off it doesn't work. > > -Jim Moore > > -----Original Message----- > From: John Carnahan [mailto:carnahan@protos.lifesci.ucla.edu] > Sent: Thursday, March 01, 2001 10:52 AM > To: LOG4J Users Mailing List > Subject: Re: Difference in using BasicConfigurator v.s. DOMCOnfigurator > > Jim, > > Why is this so? Assuming the file is local, Class.getResource will > return a URL with prefix 'file' that should work regardless of whether > the file is a properties file or xml. As long as either is somewhere in > the classpath this works great. The only question that would remain is > precedence if both are found. > > John > > > You have to provide what file to use as a system property. For example: > > > > java -Dlog4j.configuration=file:log4j.xml MyProgram > > > > -Jim Moore > > > > > > -----Original Message----- > > From: Rouwendaal, Fernand [mailto:Fernand_Rouwendaal@nl.compuware.com] > > Sent: Thursday, March 01, 2001 3:17 AM > > To: 'log4j-user@jakarta.apache.org' > > Subject: Difference in using BasicConfigurator v.s. DOMCOnfigurator > > > > > > Hi, > > > > When using the BasicConfigurator, you can make use of a very handy > feature: > > The configuration file log4j.properties is searched for in the classpath. > > Benefit: In your code, you never have to specify the location hardcoded. > > > > When using the DOMConfigurator, I cannot make this mechanism to work. Am I > > doing something wrong, or is this feature unsupported for DOMConfigurators > ? > > > > - Fernand. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: log4j-user-help@jakarta.apache.org