DOMConfigurator & Logging Parameters?
nursa Jun 27, 2012 10:16 AMHi Everyone,
Apologies if this has been covered elsewhere, i've tried looking through the documentation hosted on this site, but it doesn't appear to cover what i'm after.
I'm testing a new implementation of an EJB project in AS 7.1 before we consider migration from 5.1.
In our 5.1 server I confirgured the logging (using log4j) to work dynamically from the data, i.e. we're creating a new log file for each new order number we recieve with the DOMConfigurator.
e.g.
custom-log4j.xml
<!-- ============================================ -->
<!-- Custom logger to create order specific files -->
<!-- ============================================ -->
<appender name="CUSTOM" class="org.jboss.logging.appender.FileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="C:\\filesys\\${client.code}\\${log.type}\\${file.name}.log"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS}|%c|%-5p|%m%n"/>
</layout>
</appender>
PersistenceLayerBean:
System.setProperty("client.code", "ME");
System.setProperty("log.type", "test");
System.setProperty("file.name", "hello");
DOMConfigurator.configure(logConfig.toString()); <-- (where logConfig is the filesystem ref to the custom-log4j.xml
But i notice that there aren't many apache classes included in the new version, so i'm a bit lost:
Has the DOMConfigurator changed/moved?
Does AS7 provide this without using log4j, or must I manually include log4j & a configuration to enable this?
Any advice/direction is muchly appreciated.
If i need to include log4j manually, does anyone have a walkthrough on the filesystem requirements please? its not the same as 5.1!
Thanks,
Richard
p.s. i've put a quick custom logger into standalone.xml, which is what i was hoping to use for dynamic filenaming:
<file-handler name="MYHANDLER">
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss.SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file path="C:\\Logs\\${client.code}\\${log.type}\\${file.name}.log"/>
<append value="true"/>
</file-handler>
<logger category="ejb.PersistenceLayerBean" use-parent-handlers="false">
<level name="DEBUG"/>
<handlers>
<handler name="MYHANDLER"/>
</handlers>
</logger>