logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fabio Uechi" <fab...@alexandria.cc>
Subject Re: log4j xml configuration
Date Mon, 06 Oct 2003 08:44:03 GMT

You have to invoke the DOMConfigurator.configure method instead
of the PropertyConfigurator one.

URL log4jURL = null;
try {
     log4jURL = getServletContext().getResource("/" +
configPath);
} catch (MalformedURLException murle) {
    //ignore...we check for null later
}
if (log4jURL != null) {
     DOMConfigurator.configure(log4jURL);
}

jeffrey_chavis writes: 
> OK, I added a file named log4j.xml to a directory in the classpath 
> and this works wonderfully. 
> 
> The next question is I want to use the PropertyConfigurator to load a 
> named config file. When I pass the PropertyConfigurator a non-xml 
> file it works, but if I pass it an xml file it does not. Is there 
> something I need to do in the PropertConfigurator to get it to load 
> an XML file 
> 
> Here is the code i use to pass the filename to the 
> PropertyConfigurator 
> 
> String userDir = System.getProperty("user.dir","test"); 
> String fileSeparator = System.getProperty("file.separator"); 
> String filename = userDir + 
> fileSeparator + 
> "config" + 
> fileSeparator + 
> "Sync_GNCST_Latency_config"; 
> 
> // use the Property Configurator to configure log file. 
> PropertyConfigurator.configure(filename); 
> 
> Jeff 
> 
> 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org 
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org 
> 
> 
--------------------------------------------------------------------------------
Get your free 15 Mb POP3 email @alexandria.cc
Click here -> http://www.alexandria.cc/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message