JBoss 7 log configuration not working as expected
kdolan1 Jun 7, 2012 12:20 PMI'm confused so I appreciate anyone who can straighten me out.
Overall what I'm trying to achieve is:
* application messages (e.g., my.company) at ERROR level log in both application.log and server.log
* all other messages at ERROR level in server.log (w/ the exception of those marked WARN)
* the INFO [org.jboss.as.server.deployment.DeploymentHandlerUtil$1] JBAS018559: Deployed "someapp" message in the console
Two things to note:
* I'm okay w/ displaying the initial INFO log messages driven by the standard logging.properties file in the console.
* Before I started to constrain logging, I logged everything at INFO level to all files and the console to see what was actually being logged
Currently, my standalone.xml file contains the following:
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<console-handler name="CONSOLE" autoflush="true">
<level name="ERROR"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%C] %m%n"/>
</formatter>
<target name="System.out"/>
</console-handler>
<periodic-rotating-file-handler name="SERVER" autoflush="true">
<level name="ERROR"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%C] %m%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<periodic-rotating-file-handler name="APPLICATION" autoflush="true">
<level name="ERROR"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%C] %m%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="application.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="jacorb">
<level name="WARN"/>
</logger>
<logger category="jacorb.config">
<level name="ERROR"/>
</logger>
<logger category="my.company">
<level name="ERROR"/>
<handlers>
<handler name="APPLICATION"/>
</handlers>
</logger>
<logger category="org.jboss.as.server.deployment">
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
</handlers>
</logger>
<root-logger>
<handlers>
<handler name="SERVER"/>
</handlers>
</root-logger>
</subsystem>
Given the above,
* in the console, I ONLY see the INFO messages driven by logging.properties (i.e., up to Removing bootstrap log handlers)
* in server.log, I see nothing
* in application.log I see nothing
Problem #1:
There being nothing in server.log and application.log is correct. However, I expected to see a bunch of messages on the console....all those logged from the "org.jboss.as.server.deployment" package which includes the "Deployed" message but also much more.
I expected <logger category="org.jboss.as.server.deployment"><level name="INFO"/> to take precedence over <console-handler name="CONSOLE" autoflush="true"><level name="ERROR"/>. In other words, since that logger is configured to use the CONSOLE handler, in addition to only logging messages at ERROR level, also log messages that come from the org.jboss.as.server.deployment package at INFO level.
So, I changed the <console-handler> level to INFO. Given this, more messages were logged to the console (e.g., found something to deploy, started to deploy) but after that nothing despite the fact that I know there are in fact more non-application INFO messages (e.g., deployed).
If I also change <root-logger> to include <handler name="CONSOLE"/>, I now get LOTS of messages in the console including the "Deployed" message which is what I'm looking for. However, all of these messages include those logged from packages I don't want to see (e.g., org.jboss.as.web). I figured this is the result of the <console-handler> level set to INFO.
So, I changed the <console-handler> level back to ERROR. Given this, I'm back to seeing ONLY the INFO messages driven by logging.properties
Problem #2:
Going back to the original configuration above, if I want to see INFO messages logged from "my.company" classes in application.log, I changed <logger category="my.company"><level name="ERROR"/> to INFO. Nothing. I guess this really might be the same as Problem #1.
So, I tried one more change and that was to add use-parent-handlers="false> to <logger category="my.company"> Nothing.
At this point, I don't know what to try or what I'm doing wrong. I have the expectation that the recognition of log level, handler, and category for <logger> elements takes precedence over those for <console-handler> and <...file-handler> just like the standard log4j.xml configuration worked. However, I'm not finding this to be the case. There is VERY little documentation on this. The log schema does not help. And I've found nothing through other posts, etc. It really shouldn't be this hard.