Chapter 5. Logging for Developers
5.1.1. About Logging
Logging is the practice of recording a series of messages from an application that provide a record (or log) of the application's activities.
Log messages provide important information for developers when debugging an application and for system administrators maintaining applications in production.
Most modern logging frameworks in Java also include other details such as the exact time and the origin of the message.
5.1.2. Application Logging Frameworks Supported By JBoss LogManager
JBoss LogManager supports the following logging frameworks:
- JBoss Logging - included with JBoss EAP 6
- Apache Commons Logging - http://commons.apache.org/logging/
- Simple Logging Facade for Java (SLF4J) - http://www.slf4j.org/
- Apache log4j - http://logging.apache.org/log4j/1.2/
- Java SE Logging (java.util.logging) - http://download.oracle.com/javase/6/docs/api/java/util/logging/package-summary.html
JBoss LogManager supports the following APIs:
- JBoss Logging
JBoss LogManager also supports the following SPIs:
- java.util.logging Handler
- Log4j Appender
If you are using the
Log4j API and a
Log4J Appender, then Objects will be converted to
string before being passed.
5.1.3. About Log Levels
Log levels are an ordered set of enumerated values that indicate the nature and severity of a log message. The level of a given log message is specified by the developer using the appropriate methods of their chosen logging framework to send the message.
JBoss EAP 6 supports all the log levels used by the supported application logging frameworks. The most commonly used six log levels are (in order of lowest to highest):
Log levels are used by log categories and handlers to limit the messages they are responsible for. Each log level has an assigned numeric value which indicates its order relative to other log levels. Log categories and handlers are assigned a log level and they only process log messages of that level or higher. For example a log handler with the level of
WARN will only record messages of the levels
5.1.4. Supported Log Levels
Table 5.1. Supported Log Levels
Use for messages that provide detailed information about the running state of an application. Log messages of
TRACE are usually only captured when debugging an application.
Use for messages that indicate the progress individual requests or activities of an application. Log messages of
DEBUG are usually only captured when debugging an application.
Use for messages that indicate the overall progress of the application. Often used for application startup, shutdown and other major lifecycle events.
Use to indicate a situation that is not in error but is not considered ideal. May indicate circumstances that may lead to errors in the future.
Use to indicate an error that has occurred that could prevent the current activity or request from completing but will not prevent the application from running.
Use to indicate events that could cause critical service failure and application shutdown and possibly cause JBoss EAP 6 to shutdown.
5.1.5. Default Log File Locations
These are the log files that get created for the default logging configurations. The default configuration writes the server log files using periodic log handlers
Table 5.2. Default Log File for a standalone server
Server Log. Contains all server log messages, including server startup messages.
Garbage collection log. Contains details of all garbage collection.
Table 5.3. Default Log Files for a managed domain
Host Controller boot log. Contains log messages related to the startup of the host controller.
Process controller boot log. Contains log messages related to the startup of the process controller.
The server log for the named server. Contains all log messages for that server, including server startup messages.