Logger.properties file for configuring logger settings
Use the Logger.properties file to set logger attributes for specific loggers.
The properties file is loaded the first time that the Logger.getLogger(logger_name) method is called within an application.
Important: The name of the Logger.properties file is case sensitive. Use a capital "L" in the file name.When an application calls the Logger.getLogger method for the first time, all the available logger properties files are loaded. Applications can provide Logger.properties files in:
- the META-INF directory of the JAR file for the application
- directories included in the class path of an application module
- directories included in the application class path
The properties file contains two categories of parameters, logger control and logger data:
- Logger control information
- Minimum localization level: The minimum LogRecord level for which localization is attempted
- Group: The logical group that this component belongs to
- Event factory: The Common Base Event template file to use with the event factory. The naming convention for this template is the fully qualified component name, with a file extension of .event.xml. For example, a template that applies to the com.ibm.compXYZ package is called com.ibm.compXYZ.event.xml.
- Logger data information
- Product name
- Organization name
- Component name
- Extensions and additional properties
Syntax of the Logger.properties file
Use the following syntax to set logger properties: <logger base name>.<property>=value
where: logger base name is the starting part of the logger name to which the property applies. All loggers with names starting with this string have the property applied.
property is one of the following properties:
- organization
- product
- component
- minimum_localization_level
- group
- eventfactory
- (zos) handler_preference=operator (This property writes anything that is logged to the console WTO, write-to-operator. Without this property the AUDIT level is written only to hardcopy WTO.)
Sample Logger.properties file
In the following sample, the com.ibm.xyz.MyEventFactory event factory is used by any loggers in the com.ibm.websphere.abc package or any sub packages that do not override this value in their configuration file.
com.ibm.websphere.abc.eventfactory=com.ibm.xyz.MyEventFactory
Group Logger.properties file
In the following example, the group is MyTraceGroup and the components are com.ibm.stuff and com.ibm.morestuff:
com.ibm.stuff.group=MyTraceGroup com.ibm.morestuff.group=MyTraceGroup
Related tasks
Use Java logging in an application