Configure Java logging using the administrative console
Java logging provides a standard logging API for the applications. Before applications can log diagnostic information, specify how we want the server to handle log output and what level of logging you require.
Developing, deploying and maintaining applications are complex tasks. When an application encounters an unexpected condition, it might not be able to complete a requested operation. We might want the application to inform the administrator that the operation failed and tell the administrator why the operation failed. This information enables the administrator to take the proper corrective action. Application developers might need to gather detailed information that relates to the path of a running application to determine the root cause of a failure that is due to a code bug. The facilities used for these purposes are typically referred to as logging and tracing. For more information read Java logging.
Use the administrative console, we can:
- Enable or disable a particular log, specify where log files are stored and how many log files are kept.
- Specify the level of detail in a log, and specify a format for log output.
- Set a log level for each logger.
We can change the log configuration statically or dynamically. Static configuration changes affect applications when you start or restart the application server. Dynamic or run time configuration changes apply immediately.
When a logger is created, the level value for that logger is set from the configuration data. If no configuration data is available for a particular logger name, the level for that logger is obtained from the parent of the logger. If no configuration data exists for the parent logger, the parent of that logger is checked, and so on up the tree, until a logger with a non-null level value is found. When you change the level of a logger, the change is propagated to the children of the logger, which recursively propagates the change to their children, as necessary.
- Set the output properties for a log:
- In the navigation pane, click Troubleshooting > Log and trace.
- Click the name of the server to work with.
- Click the name of a system log to configure.
- To make a static change to the system log configuration, click the Configuration tab. To change the configuration dynamically, click the Runtime tab.
- Change the properties for the selected log according to the needs.
- Click Apply.
- Click OK.
- Set the logging levels for the logs:
- In the navigation pane, click Servers > Server Types > WebSphere application servers.
- Click the name of the server to work with.
- Under Troubleshooting, click Logs and Trace.
- Click Change Log Detail levels.
- To make a static change to the configuration, click the Configuration tab. A list of well-known components, packages, and groups is displayed. To change the configuration dynamically, click the Runtime tab. The list of components, packages, and groups displays all the components that are currently registered on the running server.
- Select a component, package, or group to set a logging level.
- [High Performance Extensible Logging] Select whether or not to disable the logging and tracing of potentially sensitive data.
- Click Apply.
- Click OK.
- To have static configuration changes take effect, stop then restart the application server.
Subtopics
- Log streams and expected output
Investigating the logging and tracing output for the application server is an excellent way to observe performance, diagnose problems, and gain a general understanding of how the application server is working within the environment. The expected output locations for logging and trace information can be different depending on the operating system on which the application server is running.
- Log level settings
Use this topic to configure and manage log level settings.
- Change the message IDs used in log files
We can change the default format for message IDs in server logs by setting the com.ibm.websphere.logging.messageId.version system property.
- HTTP error, FRCA, and NCSA access log settings
Use this page to configure the global HTTP error log, and National Center for Supercomputing Applications (NCSA) access log settings for an HTTP inbound channel. If we are running the product on z/OS, we can also use this page to configure the global Fast Response Cache Accelerator (FRCA) log settings for an HTTP inbound channel. A FRCA log is a specialized form of a NCSA log and can only be created in a z/OS environment.