Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. Logging
Logging is the most important tool to troubleshoot errors and monitor the status of the components of the Platform. log4j provides a familiar, flexible framework, familiar to Java developers.
Section 6.1, “Logging Defaults” contains information about customizing the default logging behavior for the Platform. See Section 6.2, “Component-Specific Logging” for additional customization. Appendix C, Logging Information and Recipes provides some logging recipes, which you can customize to your needs.
6.1. Logging Defaults Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The log4j configuration is loaded from the
<JBOSS_HOME>/server/<PROFILE>/conf/jboss-log4j.xml
deployment descriptor. log4j uses appenders to control its logging behavior. An appender is a directive for where to log information, and how to do it. The jboss-log4j.xml
file contains many sample appenders, including FILE, CONSOLE, and SMTP.
Configuration Option | Description |
---|---|
appender
|
The main appender. Gives the name and the implementing class.
|
errorHandler
|
Delegates an external class to handle exceptions passed to the logger, especially if the appender cannot write the log for some reason.
|
param
|
Options specific to the type of appender. In this instance, the <param> is the name of the file that stores the logs for the FILE appender.
|
layout
|
Controls the logging format. Tweak this to work with your log-parsing software of choice.
|
Example 6.1. Sample Appender
For more information on configuring log4j, see http://logging.apache.org/log4j/1.2/.