commons and log4j initializing in other web server applications

  • Thread starter gimme_this_gimme_that
  • Start date
G

gimme_this_gimme_that

The webserver in my sandbox has about 20 web applications which start
up at runtime.

I'm developing one application in particular.

The web server has classpath which includes a jar file which has a
log4j.properties file.

Several applications up before the one I'm working on.

I can tell that the other applications are finding the log4j.properties
file in the
server classpath - because if I remove it from the jar in the classpath
messages display which warning that log4j hasn't been properly
initialized.

....

My application has a start up servlet the following line of code :

org.apache.log4j.Logger rootLogger =
org.apache.log4j.LogManager.getRootLogger();
rootLogger.setLevel(org.apache.log4j.Level.DEBUG);

The idea is to set the logging level for the application in the start
up servlet.

I'm certain this code gets called. Also, a log4j.properties file and a
log4j.jar
file exists in the application's WEB-INF/lib and WEB-INF/classes
directories.

I have another class in the same application with the line of code :

private static final org.apache.commons.logging.Log LOG =
LogFactory.getLog(JdbcDAO.class);

Note that commons logging is supposed to use log4j when it finds a
log4j.properties file in the classpath.

This LOG variable always has the settings associated with the
log4j.properties
file in the classpath. Or some defaults it sets on it's own when
starting up
with no log4j.properties file.

In other words the code in the start up servlet to set the log level
isn't doing anything.

It appears that there's nothing I can do to initialize the logging
level in my application.

Note that the application this clip of code in the application
weblogic.xml file :
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

But that hasn't helped here.

Has anyone else ran into this issue and figured out a way to resolve
it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top