Question about logging in AS 7
richyclarke Aug 11, 2011 1:04 PMHi,
I am trying to setup logging for an application which should log to 3 separate log files;
1/ server.log - normal info/debug messages etc.
2/ xml log - a separate log file to log XML transmissions to and from web services we connect to
3/ mail.log - another log file which logs mail messages sent out by our application.
The above is working and the correct logs are being used,for the xml and mail messages, however the server.log and console are logging all messages to all three logs (so my console is filling up with XML and mail transcripts defeating the whole purpose of having these three separate log files).
I have the logs defined like this...
protected static Logger xmlLog = Logger.getLogger(PiscesXMLLogger);
And am using the following output instructions..
xmlLog.info("-------------------------- XML received ------------------------------- ");
The relevant parts of my logging config are shown below;
I have 3 file handlers for the 3 log files, plus a console handler, plus a root logger and 2 further loggers for the xml and mail logs.
Can anyone explain how to modify this to remove the xml and mail log entries from the server log and console?
Much appreciated.
<periodic-rotating-file-handler
file-name="d:/log/server.log"
name="FILE"
autoflush="true"
append="true"
suffix=".yyyy-MM-dd">
<error-manager>
<only-once/>
</error-manager>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</periodic-rotating-file-handler>
<periodic-rotating-file-handler
file-name="d:/log//xml.log"
name="XMLLOG"
autoflush="true"
append="false"
suffix=".yyyy-MM-dd">
<error-manager>
<only-once/>
</error-manager>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</periodic-rotating-file-handler>
<periodic-rotating-file-handler
file-name="d:/log//mail.log"
name="MAILLOG"
autoflush="true"
append="false"
suffix=".yyyy-MM-dd">
<error-manager>
<only-once/>
</error-manager>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</periodic-rotating-file-handler>
<console-handler name="CONSOLE" autoflush="true" target="System.out">
<error-manager>
<only-once/>
</error-manager>
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] %s%E%n"/>
</formatter>
</console-handler>
<logger category="PiscesXMLLogger">
<level name="DEBUG"/>
<handlers>
<handler-ref name="XMLLOG"/>
</handlers>
</logger>
<logger category="mailLogger">
<level name="DEBUG"/>
<handlers>
<handler-ref name="MAILLOG"/>
</handlers>
</logger>
<root-logger>
<level name="${jboss.server.log.threshold:INFO}"/>
<handlers>
<handler-ref name="CONSOLE"/>
<handler-ref name="FILE"/>
</handlers>
</root-logger>