Configuring Log Files and Filtering Log Messages
This section describes the contents and organization of this guide—Configuring Log Files and Filtering Log Messages.
This document describes how you use BEA WebLogic Server® logging services to monitor server, subsystem, and application events. It explains how you configure WebLogic Server to write messages to log files and listen for the log messages that WebLogic Server broadcasts, and describes how to view log messages through the WebLogic Server Administration Console.
This document is a resource for system administrators who configure WebLogic logging services and monitor server and subsystem events, and for J2EE application developers who want to integrate their application logs with WebLogic Server logs. This document is relevant to all phases of a software project, from development through test and production phases.
This document does not address application logging or localization and internationalization of log message catalogs. For links to information on these topics, see Related Documentation.
It is assumed that the reader is familiar with J2EE and Web technologies, object-oriented programming techniques, and the Java programming language.
The document is organized as follows:
The BEA corporate Web site provides all documentation for WebLogic Server. Specifically, "View and Configure Logs" in the Administration Console Online Help describes how to view and configure log files that a WebLogic Server instance generates, and Using WebLogic Logging Services for Application Logging describes how you can use WebLogic Server message catalogs, non-catalog logging, and servlet logging to produce log messages from your application or a remote Java client, and describes WebLogic's support for internationalization and localization of log messages.
In addition to this document, BEA Systems provides a variety of logging code samples and tutorials that show logging configuration and API use.
MedRec is an end-to-end sample J2EE application shipped with WebLogic Server that simulates an independent, centralized medical record management system. The MedRec application provides a framework for patients, doctors, and administrators to manage patient data using a variety of different clients.
MedRec demonstrates WebLogic Server and J2EE features, and highlights BEA-recommended best practices. MedRec is included in the WebLogic Server distribution, and can be accessed from the Start menu on Windows machines. For Linux and other platforms, you can start MedRec from the WL_HOME
\samples\domains\medrec
directory, where WL_HOME
is the top-level installation directory for WebLogic Server.
The MedRec domain installed with WebLogic Server is configured to enable Log4j logging. Several action classes and MedRec utility classes use the weblogic.logging.log4j.Log4jLoggingHelper
class to create a new logger, access a Log4j Appender, and register the Appender with the logger. Classes extending the base classes then use the logger to write informational messages to the WebLogic Server log file.
WebLogic Server 9.0 optionally installs API code examples in WL_HOME
\samples\server\examples\src\examples
, where WL_HOME
is the top-level directory of your WebLogic Server installation. You can start the examples server, and obtain information about the samples and how to run them from the WebLogic Server 9.0 Start menu.
WebLogic logging services provide the following new features and configuration options:
Enhancements to LogMBean interfaces let you control logging output by setting threshold severity levels and filters on both loggers and handlers.
In earlier versions of WebLogic Server, system administrators and developers had only programmatic access to loggers and handlers. In this release, you can configure handlers by using MBeans, eliminating the need to write code for most basic logging configurations. The Administration Console and WebLogic Scripting Tool (WLST) provide an interface for interacting with logging MBeans. Loggers are configured only through the API.
WebLogic Server supports Jakarta Project Log4j. In the Administration Console, you specify Log4j or the default Java Logging implementation. Alternatively, you can configure Log4j logging through the LogMBean interface using the LogMBean.isLog4jLoggingEnabled
attribute.
The Jakarta Commons Logging APIs provide an abstraction layer that insulates users from the underlying logging implementation. WebLogic Server provides an implementation of the Commons LogFactory
interface, letting you issue requests to the server Logger
using this API.
logs
directory below the server instance root directory; for example, DOMAIN_NAME\
servers
\SERVER_NAME\
logs
\SERVER_NAME.
log
, where DOMAIN_NAME
is the name of the directory in which you located the domain and SERVER_NAME
is the name of the server.logs
directory. The default name and location for the domain log file is DOMAIN_NAME\
servers
\ADMIN_SERVER_NAME\
logs
\DOMAIN_NAME.
log
, where DOMAIN_NAME
is the name of the directory in which you located the domain and ADMIN_SERVER_NAME
is the name of the Administration Server.LogFileRotationDir
property of the LogFileMBean
from the command line.Within a WebLogic Server domain, several MBeans configure logging services. The logging subsystem has several new or updated MBeans. Table 1-1 introduces the MBeans and Figure 1-1 illustrates the MBeans in a domain.
The Administration Server maintains an instance of |
|
Defines the base interface for common configuration across different types of logs: Server, Domain, HTTP Access, and JMS logs. Provides a consistent set of base features for the different logs created within the server, such as log file names and the location, file-rotation criteria, and number of files that a WebLogic Server instance uses to store log messages. See |
|
A log filter which determines which messages a server instance sends to the registered log destinations. Each log filter is represented by its own instance of A log filter can be defined at the domain or server level. See |
|
Path prefix for the server's JTA transaction log files. See |
|
Logging HTTP requests. See |
|
Logging HTTP requests for virtual hosts that you define. See |
|
Message log file for this JMS Server. See |
For a complete listing, see the WebLogic Server MBean Reference, which lists all deprecated and new MBeans for 9.0.