5.5.3. Sample XML Configuration for a Console Log Handler
The following procedure demonstrates a sample configuration for a console log handler.
Procedure 5.3. Configure the Console Log Handler
Add the Log Handler Identifier Information
Thename
property sets the unique identifier for this log handler.Whenautoflush
is set to"true"
the log messages will be sent to the handler's target immediately upon request.<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true">
<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true">
Copy to Clipboard Copied! Set the
level
PropertyThelevel
property sets the maximum level of log messages recorded.<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/>
<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/>
Copy to Clipboard Copied! Set the
encoding
OutputUseencoding
to set the character encoding scheme to be used for the output.<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/>
<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/>
Copy to Clipboard Copied! Define the
target
ValueThetarget
property defines the system output stream where the output of the log handler goes. This can beSystem.err
for the system error stream, orSystem.out
for the standard out stream.<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <target value="System.out"/>
<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <target value="System.out"/>
Copy to Clipboard Copied! Define the
filter-spec
PropertyThefilter-spec
property is an expression value that defines a filter. The example provided defines a filter that does not match a pattern:not(match("JBAS.*"))
.<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <target value="System.out"/> <filter-spec value="not(match("JBAS.*"))"/>
<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <target value="System.out"/> <filter-spec value="not(match("JBAS.*"))"/>
Copy to Clipboard Copied! Specify the
formatter
Useformatter
to list the log formatter used by the log handler.<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <target value="System.out"/> <filter-spec value="not(match("JBAS.*"))"/> <formatter> <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter> </console-handler> </subsystem>
<subsystem xmlns="urn:jboss:domain:logging:1.2"> <console-handler name="CONSOLE" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <target value="System.out"/> <filter-spec value="not(match("JBAS.*"))"/> <formatter> <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter> </console-handler> </subsystem>
Copy to Clipboard Copied!