I am trying to use Log4J logging in a web application, deployed on BEA.
I am writing this down from memory since I can not access my code right now. My apologies.
First, in a Java class (e.g. mypackage.MyClass), I put code like:
Second, I have created a log4j.properties file and I have put it in the web project's WEB-INF/classes folder (later on, I tried putting it in other classpath locations as well).
The properties file basically just defines the root logger, and configures it to a console output appender, at INFO level. I copied the property file content directly from an example, so I assume nothing is wrong with it (later on I tried to create a specific logger for "mypackage" as well).
When starting up the server and application, and passing through the code of MyClass, the following appears in the console output:
log4j:WARN No appenders could be found for logger (mypackage.MyClass)
log4j:WARN Please initialize the log4j system properly.
What do I need to do to get it working? It is a web application, so I assume I do not need to call some initialization method in advance, like I noticed in stand-alone Java application examples.
No change since my last post. The development team agreed in creating a Servlet called InitServlet that is loaded on startup, initializing the code in its 'init(ServletConfig)' method. Here's the method: