Tuesday, August 02, 2011

Enable DataNucleus logs in Jboss AS7

Jboss AS7 has a new logging system. It has a centralized configuration. There are only two configuration files a) standalone.xml b) domain.xml. Standalone.xml is used when jboss is running in standalone mode. domain.xml is used in domain mode. It is recommend that these file should be changed only through management api or command line features provided by jboss. It is convenient for the developer to know the standalone.xml. Every thing (almost ) in AS7 is a module or a subsystem. To get desired results one has to locate the subsystem and add his changes. For logging the subsystem is urn:jboss:domain:logging:1.0

There are two handlers <console-handler> and a <periodic-rotating-file-handler>
There can be many <loggers>

The below logger will log every thing from DataNucleus
<logger category="DataNucleus">
<level name="DEBUG">
</level></logger>

This one restricts to JDO
<logger category="DataNucleus.JDO">
<level name="DEBUG">
</level></logger>

Detailed list of loggers are here http://www.datanucleus.org/products/accessplatform_3_0/logging.html


Wait why cant I see the debug logs ?  Because you have to increase log level of your preferred handler. I have choosen to log into a FILE as below
<periodic-rotating-file-handler autoflush="true" name="FILE">
<level name="DEBUG">
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n">
</pattern-formatter></formatter>
<file path="server.log" relative-to="jboss.server.log.dir">
<suffix value=".yyyy-MM-dd">
</suffix></file></level></periodic-rotating-file-handler></loggers></periodic-rotating-file-handler></console-handler>

1 comment:

Yogesh said...

hi Kiran,

I'm trying to reach you to figure out if you managed to get the solution to problem you posted here

http://stackoverflow.com/questions/5100366/maker-checker-support-envers

I'm also trying to solve a similar problem.