Logging configuration in JBoss AS 7.0.1
jhadipak Oct 26, 2012 6:30 AMHello,
I'm developing a web application that uses log4j for logging and which gets deployed to JBoss 7.0.1 AS as a standalone. I've noticed that the logging configuration subsystem in standalone.xml has no effect, whatsoever, on the log messages that my web application tries to output. I can only exercise control over the logging behaviour of my application by having a separate log4j.xml file in its classpath (more specifically, under WEB-INF/classes).
My question is, is there a way to have one common logging configuration for a web application contained by JBoss 7 and which I can use to control the logging behaviour of BOTH core server components and my own application? I don't mind putting it all together in standalone.xml if I could somehow make JBoss honour the configuration I put in place for my own classes.
Currently, I have something like the following in standalone.xml. JBoss honours the settings "org.jboss" but completely ignores anything that I configure for "com.mycompany.myexample" below
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<console-handler name="CONSOLE" autoflush="true">
<level name="ALL"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<level name="OFF"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="org.jboss">
<level name="DEBUG"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</logger>
<logger category="com.mycompany.myexample">
<level name="TRACE"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</logger>
Appreciate any help on this. Thanks in advance.
Regards
Dipak Jha