Skip to end of metadata
Go to start of metadata


Overview

The overall server logging configuration is represented by the logging subsystem. It consists of three notable parts: handler configurations, logger and the root logger declarations (aka log categories). Each logger does reference a handler (or set of handlers). Each handler declares the log format and output:


Why is there a logging.properties file?

You may have noticed that there is a logging.properties file in the configuration directory. This logging configuration is used when the server boots up until the logging subsystem kicks in. If the logging subsystem is not included in your configuration, then this would act as the logging configuration for the entire server.

In the future this file may go away or be automatically generated from the logging subsystem. For most users this file should not be modified.

Note: If the logging.properties is not available during start there will be no logging until the logging subsystems kicks in, this is also the case if the configuration is damaged, the server might exit without any further message.


Default Log File Locations

Managed Domain

In a managed domain two types of log files do exist: Controller and server logs. The controller components govern the domain as whole. It's their responsibility to start/stop server instances and execute managed operations throughout the domain. Server logs contain the logging information for a particular server instance. They are co-located with the host the server is running on.

For the sake of simplicity we look at the default setup for managed domain. In this case, both the domain controller components and the servers are located on the same host:

Process Log File
Host Controller ./domain/log/host-controller/boot.log
Process Controller ./domain/log/process-controller/boot.log
"Server One" ./domain/servers/server-one/log/boot.log
"Server One" ./domain/servers/server-one/log/server.log
"Server Three" ./domain/servers/server-three/log/boot.log
"Server Three" ./domain/servers/server-three/log/server.log


The server logs as you know it from previous JBoss AS versions are located in the servers subdirectory: I.e. ./domain/servers/server-three/log/server.log


Standalone Server 

The default log files for a standalone server can be found in the log subdirectory of the distribution:

Process Log File
Server ./standalone/log/boot.log
Server ./standalone/log/server.log


Logging Subsystem Descriptions

root-logger

Defines the root logger for this log context.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
handlers The Handlers associated with this Logger. LIST true false read-write no-services Any

logger

Defines a logger category.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
handlers The Handlers associated with this Logger. LIST true false read-write no-services Any
use-parent-handlers Specifies whether or not this logger should send its output to it's parent Logger. BOOLEAN true false read-write no-services Any
category Specifies the category for the logger. STRING false false read-only   Any

async-handler

Defines a handler which writes to the sub-handlers in an asynchronous thread. Used for handlers which introduce a substantial amount of lag.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
name The handler's name. STRING false false read-only   Any
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
formatter Defines a formatter. STRING true false read-write no-services Any
queue-length The queue length to use before flushing writing INT false false read-write resource-services Any
overflow-action Specify what action to take when the overflowing. The valid options are 'block' and 'discard' STRING false false read-write no-services "BLOCK","DISCARD"
subhandlers The Handlers associated with this asycn handler. LIST true false read-write no-services Any

console-handler

Defines a handler which writes to the console.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
name The handler's name. STRING false false read-only   Any
encoding The character encoding used by this Handler. STRING true false read-write no-services Any
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
formatter Defines a formatter. STRING true false read-write no-services Any
autoflush Automatically flush after each write. BOOLEAN true false read-write no-services Any
target Defines the target of the console handler. The value can either be SYSTEM_OUT or SYSTEM_ERR. STRING true false read-write no-services "System.out","System.err"

file-handler

Defines a handler which writes to a file.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
name The handler's name. STRING false false read-only   Any
encoding The character encoding used by this Handler. STRING true false read-write no-services Any
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
formatter Defines a formatter. STRING true false read-write no-services Any
autoflush Automatically flush after each write. BOOLEAN true false read-write no-services Any
append Specify whether to append to the target file. BOOLEAN true false read-write resource-services Any
file The file description consisting of the path and optional relative to path. OBJECT true false read-write no-services Any

periodic-rotating-file-handler

Defines a handler which writes to a file, rotating the log after a time period derived from the given suffix string, which should be in a format understood by java.text.SimpleDateFormat.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
name The handler's name. STRING false false read-only   Any
encoding The character encoding used by this Handler. STRING true false read-write no-services Any
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
formatter Defines a formatter. STRING true false read-write no-services Any
autoflush Automatically flush after each write. BOOLEAN true false read-write no-services Any
append Specify whether to append to the target file. BOOLEAN true false read-write resource-services Any
file The file description consisting of the path and optional relative to path. OBJECT true false read-write no-services Any
suffix Set the suffix string. The string is in a format which can be understood by java.text.SimpleDateFormat. The period of the rotation is automatically calculated based on the suffix. STRING false false read-write no-services Any

size-rotating-file-handler

Defines a handler which writes to a file, rotating the log after a the size of the file grows beyond a certain point and keeping a fixed number of backups.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
name The handler's name. STRING false false read-only   Any
encoding The character encoding used by this Handler. STRING true false read-write no-services Any
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
formatter Defines a formatter. STRING true false read-write no-services Any
autoflush Automatically flush after each write. BOOLEAN true false read-write no-services Any
append Specify whether to append to the target file. BOOLEAN true false read-write resource-services Any
file The file description consisting of the path and optional relative to path. OBJECT true false read-write no-services Any
rotate-size The size at which to rotate the log file. STRING false false read-write no-services Any
max-backup-index The maximum number of backups to keep. INT false false read-write no-services Any

custom-handler

Defines a custom logging handler. The custom handler must extend java.util.logging.Handler.

Attribute Description Type Allow Null Expression Allowed Access Type Restart Required Allowed Values
name The handler's name. STRING false false read-only   Any
encoding The character encoding used by this Handler. STRING true false read-write no-services Any
level The log level specifying which message levels will be logged by this. Message levels lower than this value will be discarded. STRING true false read-write no-services "ALL","CONFIG","DEBUG","ERROR","FATAL","FINE","FINER","FINEST","INFO","OFF","TRACE","WARN","WARNING"
filter Defines a simple filter type. OBJECT true false read-write no-services "all","any","accept","change-level","deny","level","level-range","match","not","replace"
formatter Defines a formatter. STRING true false read-write no-services Any
class The logging handler class to be used. STRING false false read-only   Any
module The module that the logging handler depends on. STRING false false read-only   Any
properties Defines the properties used for the logging handler. All properties must be accessible via a setter method. LIST false false read-write no-services Any

What is the %s and %E in the pattern-formatter's pattern?

%s is the message

%E is the exception if one exists

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 15, 2012

    It would be useful to have a section which explains the role that

    /standalone/configuration/logging.properties

    has and whether it overrides the standalone.xml logging configuration.

    The standalone.bat file includes the system property

    -Dlogging.configuration=....../standalone/configuration/logging.properties

    which suggests it does play a role?

    1. May 30, 2012

      Hello Peter

      The answer is in this same page: Why is there a logging.properties file?

  2. Sep 15, 2012

    why can i set the log level on both the logger and the handler? 

    1. Sep 15, 2012

      You can set the log level on any logger or any handler. Is there something specific you're seeing?

      1. Sep 16, 2012

        i just thought why to set a log level on a handler if it can be set on the log category already. Is the log level on the handler some kind of general filter to the output. E.g. in case someone set a finer level on the log category but the log messages e.g. below DEBUG should not go to that handler?

      2. Sep 17, 2012

        after playing with the logging configuration in standalone.xml i think that setting the log levels does not work correctly:

        <size-rotating-file-handler name="ACTHANDLER" autoflush="true">
            <level name="DEBUG"/>
            <formatter>
                <pattern-formatter pattern="%d %-8p (%-40t) %s%E [%c] %n"/>
            </formatter>
            <file relative-to="jboss.server.log.dir" path="activiti.log"/>
            <rotate-size value="20m"/>
            <max-backup-index value="10"/>
            <append value="true"/>
        </size-rotating-file-handler>

        <logger category="org.activiti" use-parent-handlers="false">
            <level name="DEBUG"/>
            <handlers>
                <handler name="ACTHANDLER"/>
            </handlers>
        </logger>

        The log file gets messages at level FINE as well. Or do i miss something? Is the order of levels different than i assume?

        1. Sep 19, 2012

          FINE is equivalent to DEBUG. If a logger category is set to log at level DEBUG it has to have a handler, either attached or attached to a parent logger, that can output at a DEBUG level.

  3. Nov 12, 2012

    See this discussion for the semantics.

    It would be nice if the documentation itself contained that information.

  4. Oct 03, 2013

    Does this %m pattern is supported in pattern-formatter? Or it's replaced by %s?

    1. Oct 03, 2013

      Yes, %m is supported. It would be the same as using %s%E.

  5. Oct 09, 2013

    I'd like to use the periodic-rotating-file-handler, but also to be able to limit the number of backups, as provided by the size-rotating-file-handler.

    I guess I'll have to develop my own custom handler, right?

    Thanks.

    1. Oct 09, 2013

      Correct. Another option would be to have some kind of cron-job or clean utility that just deletes log files older than X date.

  6. Feb 10, 2014

    Hi Joysn,

    I know its very late, but felt it would be useful for you in future.

    You could also exclude other log level recorded into the log file by adding the filter in this way:

    <periodic-rotating-file-handler name="FILE" autoflush="true">

                    <level name="DEBUG"/>

                    <filter-spec value="levels(DEBUG)"/>

                    <formatter>

                        <pattern-formatter pattern="%d %-8p (%-40t) %s%E [%c] %n"/>

                    </formatter>

                    <file relative-to="jboss.server.log.dir" path="server.log"/>

                    <suffix value=".yyyy.MM.dd"/>

                </periodic-rotating-file-handler>

    Hope this helps you.. :)

  7. Feb 18, 2014

    I have configured the custom module for standalone mode as follow but it did not work as expected. I am wondering is there any way to configure settings either in standalone mode or manged domain mode such that "server.log" file is saved into the remote machine? 

    1. Feb 18, 2014

      I have found the solution. Custom-handler for SocketAppender works perfectly fine with the JBoss AS 7.1.3. However, custom-handler for SocketAppender won't work for JBoss AS 7.1.1 and creates following exception:

      JBAS014777:   Services which failed to start:   service jboss.logging.handler.SocketHandler: org.jboss.msc.service.StartException in service jboss.logging.handler.SocketHandler: JBAS011543: 'org.apache.log4j.net.SocketAppender' is not a valid class java.util.logging.Handler.

      The only one way to make it work in JBoss AS 7.1.1 is to develop a custom java.util.logging.Handler for SocketAppender. For more information, reference can be taken from the URL https://community.jboss.org/wiki/CreatingACustomLoggingHandlerInJBOSSAs710Final  

      1. Feb 18, 2014

        Yes. You cannot use log4j appenders as custom-handlers in JBoss AS 7.1.1. Also please use https://community.jboss.org/en/jbossas7/content for discussions.

        1. Feb 18, 2014

          Thank you James for your information. I will surely use the link you mentioned for discussions later :) 

  8. Feb 11, 2014

    I am using Jboss EAP 6.1.1 , the server.log file is getting huge with the periodic rotating file handler, so I included the size rotating file handler.
    Using the following entry in my standalone.xml file
    <size-rotating-file-handler name="FILE">
                    <formatter>
                        <pattern-formatter pattern="%d

    Unknown macro: {HH}

    %-5p [%c] (%t) %s%E%n"/>
                    </formatter>
                    <file relative-to="jboss.server.log.dir" path="server.log"/>
                    <rotate-size value="100k"/>
                    <max-backup-index value="10"/>
                    <append value="true"/>
                </size-rotating-file-handler>
    It is generating the files and spliting it as server.log, server.log.1 based on the configuration size value.
    Is there any way that I could also add the the date in the file name???
    I tried adding '<suffix value=".yyyy-MM-dd"/>' in the above tag. But its showing parsing error while server start up. Please let me know is there any way for the same?
    I am using Jboss EAP 6.1.1 , the server.log file is getting huge with the periodic rotating file handler, so I included the size rotating file handler.

    Using the following entry in my standalone.xml file

    <size-rotating-file-handler name="FILE">

                    <formatter>

                        <pattern-formatter pattern="%d

    Unknown macro: {HH}

    %-5p [%c] (%t) %s%E%n"/>

                    </formatter>

                    <file relative-to="jboss.server.log.dir" path="server.log"/>

                    <rotate-size value="100k"/>

                    <max-backup-index value="10"/>

                    <append value="true"/>

                </size-rotating-file-handler>

    It is generating the files and spliting it as server.log, server.log.1 based on the configuration size value.

    Is there any way that I could also add the the date in the file name???

    I tried adding '<suffix value=".yyyy-MM-dd"/>' in the above tag. But its showing parsing error while server start up. Please let me know is there any way for the same?