Reputation: 137
I have created Web Application by using JSF 2.0, Log 4j 1.2.14 and JBoss 7. When I run testcase, the log file is created. And the log file can't create when I run web application.
I there is anything I need to configur, please tell me.
Upvotes: 0
Views: 503
Reputation: 42030
Make sure the configuration file (log4j.xml
or log4j.properties
) is in the classpath of the web application (in this case, in the binaries).
WEB-INF/classes/log4j.properties
If you have both files (log4.properties
, log4j.xml
) only is considered log4j.xml
. The first time you init or use some instance of org.apache.log4j.Logger
, log4j search the configuration file in the classpath, then the configuration is loaded.
If you want to see this process of searching and loading more closely, add the following argument to the virtual machine:
-Dlog4j.debug
Upvotes: 0
Reputation: 2615
Take a look at this maybe can help you.
The following filejboss-deployment-structure.xmlneeds to contain the following:
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Upvotes: 2