5.5.4. Sample XML Configuration for a File Log Handler
The following procedure demonstrates a sample configuration for a file log handler.
Procedure 5.4. Configure the File Log Handler
Add the File Log Handler Identifier Information
Thenameproperty sets the unique identifier for this log handler.Whenautoflushis set to"true"the log messages will be sent to the handler's target immediately upon request.<file-handler name="accounts-rec-trail" autoflush="true">
<file-handler name="accounts-rec-trail" autoflush="true">Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
levelPropertyThelevelproperty sets the maximum level of log message that the root logger records.<file-handler name="accounts-rec-trail" autoflush="true"> <level name="INFO"/><file-handler name="accounts-rec-trail" autoflush="true"> <level name="INFO"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
encodingOutputUseencodingto set the character encoding scheme to be used for the output.<file-handler name="accounts-rec-trail" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/><file-handler name="accounts-rec-trail" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
fileObjectThefileobject represents the file where the output of this log handler is written to. It has two configuration properties:relative-toandpath.Therelative-toproperty is the directory where the log file is written to. JBoss Enterprise Application Platform 6 file path variables can be specified here. Thejboss.server.log.dirvariable points to thelog/directory of the server.Thepathproperty is the name of the file where the log messages will be written. It is a relative path name that is appended to the value of therelative-toproperty to determine the complete path.<file-handler name="accounts-rec-trail" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <file relative-to="jboss.server.log.dir" path="accounts-rec-trail.log"/><file-handler name="accounts-rec-trail" autoflush="true"> <level name="INFO"/> <encoding value="UTF-8"/> <file relative-to="jboss.server.log.dir" path="accounts-rec-trail.log"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Specify the
formatterUseformatterto list the log formatter used by the log handler.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
appendPropertyWhen theappendproperty is set to"true", all messages written by this handler will be appended to an existing file. If set to"false"a new file will be created each time the application server launches. Changes toappendrequire a server reboot to take effect.Copy to Clipboard Copied! Toggle word wrap Toggle overflow