Application-specific logging in JBoss AS 6 (yet again)
pgmjsd Jun 20, 2011 2:22 PMJBoss AS 6.0.0.Final and app-specific logging - I've tried putting jboss-logging.xml in the META-INF directory of an EAR deployment as this post suggests. When JBoss starts it does seem to be reading the file, but the file is always empty. When I use a JBoss Logging 'Logger', the output shows up in 'server.log', configured in deploy/jboss-logging.xml but never in the application specific log file. I've tried using the JBoss Logging API directly, but it's as if the application-specific logging configuration is pretty much ignored except initially creating the log file.
Do I have to do something with the class loaders or something?
Here's the jboss-logging file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- My application jboss-logging.xml -->
<logging xmlns="urn:jboss:logging:6.0" context="MyApplication">
<!--
~ This element, in conjunction with the "context" attribute above, tells the
~ logging system that I want my own separate logging environment.
-->
<define-context name="MyApplication"/>
<!-- A time/date based rolling handler -->
<periodic-rotating-file-handler
file-name="${jboss.server.log.dir}/application.log"
name="FILE"
autoflush="true"
append="true"
suffix=".yyyy-MM-dd"> <!-- To roll over at the top of each hour, use ".yyyy-MM-dd-HH" instead -->
<error-manager>
<only-once/>
</error-manager>
<formatter>
<!-- To revert back to simple stack traces without JAR versions, change "%E" to "%e" below. -->
<!-- Uncomment this to get the class name in the log as well as the category
<pattern-formatter pattern="%d %-5p [%c] %C{1} (%t) %s%E%n"/>
-->
<!-- Uncomment this to log without the class name in the log -->
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</periodic-rotating-file-handler>
<!-- Configure the root logger with my handler from above -->
<root-logger>
<level name="DEBUG"/>
<handlers>
<handler-ref name="FILE"/>
</handlers>
</root-logger>
</logging>
I can switch over to Log4J, but I want to make sure I'm not missing something obvious before I do that.