Sep 13, 2018

How to Change the Log Level for GlassFish Server Logger?

Each application uses its own application logger to log messages. To configure the log level for a particular application, use one of two options:


  • In the Admin GUI Log Level configuration page add a property with a property name representing the logger name, and the valuerepresenting one of seven log levels (FINESTFINERFINECONFIGINFOWARNINGSEVERE) or OFF.
    For example, to change the log level of application logger named it.i88.ca to FINEST, the property name would be it.i88.caand the property value would be FINEST. The change is reflected in the domain.xml file, and takes effect immediately. No Server restart is required.
  • Directly add the property to the <module-log-levels\> element in domain.xml, as shown below.
    <module-log-levels admin="INFO" classloader="INFO" cmp="INFO"
    cmp-container="INFO" configuration="INFO" connector="INFO" 
    corba="INFO" deployment="INFO" ejb-container="INFO" javamail="INFO" 
    jaxr="INFO" jaxrpc="INFO" jdo="INFO" jms="INFO" jta="INFO" 
    jts="INFO" mdb-container="INFO" naming="INFO" node-agent="INFO"
    resource-adapter="INFO" root="INFO" saaj="INFO" security="INFO" 
    server="INFO" synchronization="INFO" util="INFO" verifier="INFO" 
    web-container="INFO"\>
        <property name="it.i88.ca" value="FINEST" /\>
    </module-log-levels\>
Listing Logger Levels for Modules

Use the list-logger-levels subcommand in remote mode to list the modules and their current log levels.
asadmin> list-logger-levels
javax.enterprise.system.container.cmp: INFO
javax.enterprise.system.tools.admin: INFO
java.util.logging.ConsoleHandler: FINEST
javax.enterprise.system.container.web: INFO
javax.enterprise.system.util: INFO
javax.enterprise.resource.webcontainer.jsf.timing: INFO
javax: INFO
javax.enterprise.resource.corba: INFO
...
Command list-logger-levels executed successfully.

To Set the Global Log Level

java.util.logging.ConsoleHandler.level = INFO 
java.util.logging.ConsoleHandler.formatter = 
com.sun.enterprise.server.logging.UniformLogFormatter

Setting Log Levels for Multiple Loggers
asadmin> set-log-level javax.enterprise.system.core.security.level=FINE
javax.enterprise.system.container.web=WARNING 
Command set-log-level executed successfully.