I am using jboss as 7 offline. I use spring in my application, when I run my application, I get the following error in the server log:
17:40:19,669 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment). 17:40:19,671 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) log4j:WARN Please initialize the log4j system properly.
So, I set up jboss by adding a logger as follows:
<logger category="org.springframework.core.env.StandardEnvironment"> <level name="DEBUG"/> <handlers> <handler name="CONSOLE"/> <handler name="FILE"/> <handler name="TESTFILE"/> </handlers> </logger>
The CONSOLE handler is defined as follows:
<console-handler name="CONSOLE" autoflush="true"> <level name="DEBUG"/> <formatter> <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter> </console-handler>
But even after that I keep getting the same error, why?
Decision:
The invalid part meant that the application should use the logging jboss as (log4j) subsystem located in its modules directory, more precisely in org/apache/log4j . This is done by adding the jboss-deployment-structure.xml file to WEB-INF containing the following:
<jboss-deployment-structure> <deployment> <dependencies> <module name="org.apache.log4j"/> </dependencies> </deployment> </jboss-deployment-structure>
source share