You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Pa...@b-source.ch on 2006/01/02 11:24:48 UTC
loading log4j.properties from an ear file
Hello,
I developed a very simple ear application that includes a web app and a
stateless EJB.
The EJB uses log4j.
This application runs in weblogic8.1 server. I am using
log4j-1.2.13.jar.
The ear structure is as follows:
C:\software\bea8\config\local\applications>jar tvf RuleApp.ear
0 Mon Jan 02 11:07:56 CET 2006 META-INF/
79 Mon Jan 02 11:07:54 CET 2006 META-INF/MANIFEST.MF
466 Thu Dec 22 18:13:44 CET 2005 META-INF/application.xml
4725 Mon Jan 02 11:07:56 CET 2006 RuleAppWeb.war
6955 Mon Jan 02 11:07:56 CET 2006 RuleService.jar
0 Mon Jan 02 11:08:02 CET 2006 etc/
0 Mon Jan 02 11:08:02 CET 2006 etc/properties/
2340 Mon Jan 02 11:08:02 CET 2006 etc/properties/log4j.properties
358180 Sun Dec 04 19:00:48 CET 2005 log4j-1.2.13.jar
1278 Mon Jan 02 11:07:52 CET 2006 utils.jar
Inside the EJB (RuleService), in order to load the log4j.properties
file, I do:
if (logger == null)
{
logger = Logger.getLogger(RuleServiceEJB.class);
URL propertyFileURL =
Thread.currentThread().getContextClassLoader().getResource(LOG4J_PROPERT
Y_FILE);
if (propertyFileURL != null)
PropertyConfigurator.configure(propertyFileURL);
else
System.out.println ("FATAL, " + LOG4J_PROPERTY_FILE + "
not found !");
}
where
private static final String LOG4J_PROPERTY_FILE =
"etc/properties/log4j.properties";
but I'm not able to load the log4j.properties file: the propertyFileURL
is null !
Could someone please help me to understand why ?
Thanks
Patrizio
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org