Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

12.5. Logging Profiles

12.5.1. About Logging Profiles


Logging profiles are only available in version 6.1.0 and later. They cannot be configured using the management console.
Logging profiles are independent sets of logging configuration that can be assigned to deployed applications. As with the regular logging subsystem, a logging profile can define handlers, categories and a root logger but cannot refer to configuration in other profiles or the main logging subsystem. The design of logging profiles mimics the logging subsystem for ease of configuration.
The use of logging profiles allows administrators to create logging configuration that are specific to one or more applications without affecting any other logging configuration. Because each profile is defined in the server configuration, the logging configuration can be changed without requiring that the affected applications be redeployed.
Each logging profile can have the following configuration:
  • A unique name. This is required.
  • Any number of log handlers.
  • Any number of log categories.
  • Up to one root logger.
An application can specify a logging profile to use in its MANIFEST.MF file, using the logging-profile attribute.

12.5.2. Create a new Logging Profile using the CLI

A new logging profile can be created using the CLI command below, replacing NAME with your required profile name:
This will create a new empty profile to which handlers, categories and a root logger can be added.

12.5.3. Configuring a Logging Profile using the CLI

A logging profile can be configured with log handlers, categories and a root logger using almost exactly the same syntax as when using the main logging subsystem.
There are only two differences between configuring the main logging subsystem and the logging profile:
  1. The root configuration path is /subsystem=logging/logging-profile=NAME
  2. A logging profile cannot contain other logging profiles.
Refer to the appropriate logging management task:

Example 12.79. Creating and Configuring a Logging Profile

Creating a logging profile and adding a category and file log handler.
  1. Create the profile:
  2. Create file handler
    /subsystem=logging/logging-profile=accounts-app-profile/file-handler=ejb-trace-file:add(file={path=>"ejb-trace.log", "relative-to"=>"jboss.server.log.dir"})
    /subsystem=logging/logging-profile=accounts-app-profile/file-handler=ejb-trace-file:write-attribute(name="level", value="DEBUG")
  3. Create logger category
  4. Assign file handler to category

12.5.4. Specify a Logging Profile in an Application

An application specifies the logging profile to use in its MANIFEST.MF file.


  1. You must know the name of the logging profile that has been setup on the server for this application to use. Ask your server administrator for the name of the profile to use.

Procedure 12.9. Add Logging Profile configuration to an Application


    If your application does not have a MANIFEST.MF file: create one with the following content, replacing NAME with the required profile name.
    Manifest-Version: 1.0
    Logging-Profile: NAME
    If your application already has a MANIFEST.MF file: add the following line to it, replacing NAME with the required profile name.
    Logging-Profile: NAME


If you are using Maven and the maven-war-plugin, you can put your MANIFEST.MF file in src/main/resources/META-INF/ and add the following configuration to your pom.xml file.
When the application is deployed it will use the configuration in the specified logging profile for its log messages.

12.5.5. Example Logging Profile Configuration

This example shows the configuration of a logging profile and the application that makes use of it. The CLI session is shown, the XML configuration that is generated, and the MANIFEST.MF file of the application.
The logging profile example has the following characteristics:
  • The Name is accounts-app-profile.
  • The Log Category is
  • The Log level TRACE.
  • The Log handler is a file handler using the file ejb-trace.log.

Example 12.80. CLI session

localhost:bin user$ ./ -c
[standalone@localhost:9999 /] /subsystem=logging/logging-profile=accounts-app-profile:add
{"outcome" => "success"}

[standalone@localhost:9999 /] /subsystem=logging/logging-profile=accounts-app-profile/file-handler=ejb-trace-file:add(file={path=>"ejb-trace.log", "relative-to"=>"jboss.server.log.dir"})
{"outcome" => "success"}

[standalone@localhost:9999 /] /subsystem=logging/logging-profile=accounts-app-profile/file-handler=ejb-trace-file:write-attribute(name="level", value="DEBUG")
{"outcome" => "success"}

[standalone@localhost:9999 /] /subsystem=logging/logging-profile=accounts-app-profile/
{"outcome" => "success"}

[standalone@localhost:9999 /] /subsystem=logging/logging-profile=accounts-app-profile/"ejb-trace-file")
{"outcome" => "success"}

Example 12.81. XML Configuration

   <logging-profile name="accounts-app-profile">
      <file-handler name="ejb-trace-file">
         <level name="DEBUG"/>
         <file relative-to="jboss.server.log.dir" path="ejb-trace.log"/>
      <logger category="">
         <level name="TRACE"/>
            <handler name="ejb-trace-file"/>

Example 12.82. Application MANIFEST.MF file

Manifest-Version: 1.0
Logging-Profile: accounts-app-profile