Version 15

    JBoss Boot Logging

    JBoss uses the Log4jService (in JBoss AS 5.x and earlier) or the LoggingService (in JBoss AS 6.x and later) to configure logging.

    This service is not configured until after the bootstrap phase.

     

    During the bootstrap the microkernel logs into log/boot.log using the configuration

    from log4j.properties (in 5.x and earlier) or logging.properties (in 6.x and later) in $JBOSS_HOME/bin/run.jar.

     

    Customizing Boot Logging

    You can either change the configuration inside run.jar or use a system property to reference an outside configuration file.

    Changing log4j.properties or logging.properties inside run.jar

    The simplest strategy is to un-jar $JBOSS_HOME/bin/run.jar, change the appropriate properties file and re-jar. (the Open Source archiving software 7-zip does a good job at editing files inside of archives). For AS 5.x and earlier, two pre-configured alternate property files exist in run.jar for DEBUG and TRACE logging.  In 6.x and later, the following system properties may be used to override the log level setting:

    • jboss.boot.server.log.level sets the log level for the root logger (i.e. controls what is returned by isXXXEnabled() calls against the root logger or any subcategory that isn't otherwise configured. Default is INFO.
    • jboss.boot.server.log.console.level sets the minimum level for messages to be handled by the handler that writes to the console. Default is INFO.
    • jboss.boot.server.log.file.level sets the minimum level for messages to be handled by the handler that writes to the boot.log file. Default is DEBUG.
    • jboss.boot.server.log.serverinfo.level sets the log level for the org.jboss.system.server.ServerInfo category. Default is DEBUG, which allows some useful configuration information to be written to the boot.log (whose handler by default accepts DEBUG messages). This property was added for 6.0.0.M2.

    Referencing an outside configuration

    If you're looking for a less intrusive option, follow these steps:

    • extract log4j.properties or logging.properties from run.jar into, e.g. bin/log4j.properties or bin/logging.properties

    • edit run.bat (or .sh) and add:

    set JAVA_OPTS=%JAVA_OPTS% -Dlog4j.configuration=file:%DIRNAME%log4j.properties

    or for 6.x and later:

    set JAVA_OPTS=%JAVA_OPTS% -Dlogging.configuration=file:%DIRNAME%logging.properties

    During the bootstrap your log4j initialization file will be used in place of the one located in run.jar

     

    You can also specify the boot log configuration at the command line, instead of editing run.bat/run.sh, for example:

       run.bat -Dlog4j.configuration=file:./log4j.properties
    

    or for 6.x and later:

       run.bat -Dlogging.configuration=file:./logging.properties

    or better, specify the full (URL) path to the file

       run.bat -Dlog4j.configuration=file:///C:/jboss/jboss-4.0.2/bin/log4j.properties
    

    or for 6.x and later:

       run.bat -Dlogging.configuration=file:///C:/jboss/jboss-6.0.0/bin/logging.properties
    

    Logging command line options in boot.log

    Since AS 5.1.0.Beta1, command line parameters, including VM parameters, are shown in the boot.log. This has been achieved taking advantage of the following method available since JDK5: java.lang.management.RuntimeMXBean.getInputArguments(). See JBAS-5240 for further details. Example:

    13:44:43,226 INFO [ServerInfo] VM arguments: -Dprogram.name=run.sh
    -Xms128m -Xmx512m -XX:MaxPermSize=256m
    -Dorg.jboss.resolver.warning=true
    -Dsun.rmi.dgc.client.gcInterval=3600000
    -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true
    -Djava.endorsed.dirs=/home/galder/jboss/code/as/trunk/build/output/jboss-6.0.0.Alpha1/lib/endorsed
    

     

    Logging configuration properties (6.x and up)

    As of AS 6.0.0, the boot-time logging subsystem may be configured through the use of a logging.properties file.  The following properties may be specified:

     

    • Logger options
      • loggers=<category>[,<category>,...] - Specify a comma-separated list of logger categories which will be configured.  Any categories not listed here will not be configured from the following properties.
      • logger.<category>.level=<level> - Specify the level for a category.  The level can be a JDK logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST), a log4j-style level (FATAL, ERROR, WARN, INFO, DEBUG, TRACE), or a special level (OFF, ALL).  If unspecified, the nearest parent's level will be inherited.
      • logger.<category>.handlers=<handler>[,<handler>,...] - Specify a comma-separated list of the names of handlers to attach to this logger.  The handlers must be configured in the same properties file.
      • logger.<category>.filter=<filter> - Specify a filter for a category.  The filter must be configured in the same properties file.
      • logger.<category>.useParentHandlers=(true|false) - Specify whether log messages should cascade up to parent handlers.  The default value is true.
    • Handler options
      • handler.<name>=<className> - (Required) Specify the class name of the handler to instantiate.
      • handler.<name>.level=<level> - Restrict the level of this handler.  If unspecified, the default value of ALL is retained.
      • handler.<name>.encoding=<encoding> - Specify the character encoding, if it is supported by this handler type.  If not specified, a handler-specific default is used.
      • handler.<name>.errorManager=<name> - Specify the name of the error manager to use.  The error manager must be configured in the same properties file.  If unspecified, no error manager is configured.
      • handler.<name>.filter=<name> - Specify the name of the filter to use.  The filter must be configured in the same properties file.  If unspecified, messages are not filtered.
      • handler.<name>.formatter=<name> - Specify the name of the formatter to use, if it is supported by this handler type.  The formatter must be configured in the same properties file.  If not specified, messages will not be logged for most handler types.
      • handler.<name>.properties=<property>[,<property>,...] - Specify a list of JavaBean-style properties to additionally configure.  A rudimentary type introspection is done to ascertain the appropriate conversion for the given property.
      • handler.<name>.<property>=<value> - Set the value of the named property.
    • Error manager options
      • errorManager.<name>=<className> - (Required) Specify the class name of the error manager to instantiate.
      • errorManager.<name>.properties=<property>[,<property>,...] - Specify a list of JavaBean-style properties to additionally configure.  A rudimentary type introspection is done to ascertain the appropriate conversion for the given property.
      • errorManager.<name>.<property>=<value> - Set the value of the named property.
    • Formatter options
      • formatter.<name>=<className> - (Required) Specify the class name of the formatter to instantiate.
      • formatter.<name>.properties=<property>[,<property>,...] - Specify a list of JavaBean-style properties to additionally configure.  A rudimentary type introspection is done to ascertain the appropriate conversion for the given property.
      • formatter.<name>.<property>=<value> - Set the value of the named property.
    • Filter options
      • filter.<name>=<className> - (Required) Specify the class name of the filter to instantiate.
      • filter.<name>.properties=<property>[,<property>,...] - Specify a list of JavaBean-style properties to additionally configure.  A rudimentary type introspection is done to ascertain the appropriate conversion for the given property.
      • filter.<name>.<property>=<value> - Set the value of the named property.

    Example configuration

    This is an example logging.properties that you can use to get started.

     

    # Additional logger names to configure (root logger is always configured)
    #loggers=org.foo.bar, org.foo.baz
    
    # Root logger level
    logger.level=DEBUG
    
    # Declare handlers for the root logger
    logger.handlers=CONSOLE, FILE
    
    # Declare handlers for additional loggers
    #logger.org.foo.bar.handlers=XXX, YYY
    
    # Console handler configuration
    handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
    handler.CONSOLE.properties=autoFlush
    handler.CONSOLE.level=INFO
    handler.CONSOLE.autoFlush=true
    handler.CONSOLE.formatter=PATTERN
    
    # File handler configuration
    handler.FILE=org.jboss.logmanager.handlers.FileHandler
    handler.FILE.level=DEBUG
    handler.FILE.properties=autoFlush,fileName
    handler.FILE.autoFlush=true
    handler.FILE.fileName=your/log/directory/server.log
    handler.FILE.formatter=PATTERN
    
    # The log format pattern for both logs
    formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
    formatter.PATTERN.properties=pattern
    formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n