Logging and Filtering
We are going to discuss about:
- UsagWee of Logs
- Server Log Files and Domain Log Files
- Message Formats & Attributes
- Configuring WebLogic Logging Services
- Filtering WebLogic Server Log Messages
- Using the console to Monitor
This chapter describes how you use 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. It also describes how to view log messages through the WebLogic Server Administration Console.
WebLogic Server subsystems use logging services to provide information about events such as the deployment of new applications or the failure of one or more subsystems. A server instance uses them to communicate its status and respond to specific events. For example, you can use WebLogic logging services to report error conditions or listen for log messages from a specific subsystem.
- Logs can aid in the discovery of:
- frequently accessed resources
- activity by day and time interval
- amount of data sent and received
- IP addresses of users accessing the site
- number of actual “hits”
- problems servicing requests
- performance statistics
Server Log Files and Domain Log Files
Each WebLogic Server instance writes all messages from its subsystems and applications to a server log file that is located on the local host computer. By default, the server log file is located in the 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.
In addition to writing messages to the server log file, each server instance forwards a subset of its messages to a domain-wide log file. By default, servers forward only messages of severity level NOTICE or higher. While you can modify the set of messages that are forwarded, servers can never forward messages of the DEBUG severity level.
The domain log file provides a central location from which to view the overall status of the domain. The domain log resides in the Administration 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.
Message Formats & Attributes
Log Message Format
When a WebLogic Server instance writes a message to the server log file, the first line of each message begins with #### followed by the message attributes. Each attribute is contained between angle brackets.
Here is an example of a message in the server log file:
####<Sept 22, 2004 10:46:51 AM EST> <Notice> <WebLogicServer> <MyComputer>
<examplesServer> <main> <<WLS Kernel>> <> <null> <1080575211904> <BEA-000360> <Server started in RUNNING mode>
In this example, the message attributes are: Locale-formatted Timestamp, Severity, Subsystem, Machine Name, Server Name, Thread ID, User ID, Transaction ID, Diagnostic Context ID, Raw Time Value, Message ID, and Message Text. (A subsequent section, “Message Attributes,” describes each attribute.)
Format of Output to Standard Out and Standard Error
When a WebLogic Server instance writes a message to standard out, the output does not include the #### prefix and does not include the Server Name, Machine Name, Thread ID, User ID, Transaction ID, Diagnostic Context ID, and Raw Time Value fields.
Here is an example of how the message from the previous section would be printed to standard out:
<Sept 22, 2004 10:51:10 AM EST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode
In this example, the message attributes are: Locale-formatted Timestamp, Severity, Subsystem, Message ID, and Message Text.
The messages for all WebLogic Server instances contain a consistent set of attributes. In addition, if your application uses WebLogic logging services to generate messages, its messages will contain these attributes.
Message Severity & Messages Forwarded to Domain Log
The severity attribute of a WebLogic Server log message indicates the potential impact of the event or condition that the message reports.
Message catalogs are available in HTML format on e-docs as part of the documentation deliverable. You can search for messages by error number using the search engine.
Configuring WebLogic Logging Services
Logging Configuration Tasks: Main Steps
The following steps summarize how you configure and filter log messages that WebLogic Server generates. Related documentation and later sections in this guide describe these steps in more detail.
- Use the Administration Console to manage log files and configure the following logging options:
- Domain and server log file name and location, rotation pattern, location of archived log files, and number of log files stored.
- Types of messages that the server sends to standard out.
- Which messages a server instance sends to the domain log.
- Log files for HTTP requests.
- Specify the logging implementation (Java Logging or Log4j).
- Specify message destination and configure filtering log messages by severity level or other criteria. See “Filter log messages” in the Administration Console Online Help.
- Alternatively, configure log message filtering on the message handler using the WebLogic Scripting Tool.
- Filter log messages published by the logger using the Java APIs.
Environment -> Servers -> Logging…
Filtering WebLogic Server Log Messages
WebLogic logging services provide several filtering options that give you the flexibility to determine which messages are written to WebLogic Server log files and standard out, and which are written to the log file and standard out that a client JVM maintains.
- Log filters provide control over the log messages that get published.
- You can filter out messages of a certain severity level, from a particular subsystem, or according to specified criteria
- You can create separate filters for the messages that each server instance writes to:
- its server log file
- standard out
- memory buffer
- domain-wide log
Create Log Filters
Domain -> Configuration -> Log Filters and then click on New
Step 2: Specify the Name of the Filter and click on Finish Button and Click on Activate Changes
Step 3: Specify the conditions according to the requirement and then apply save and Activate Changes.
Assigning a Log Filter to Server
Servers -> Select Server -> Logging -> Advanced and then apply the Filter according to the requirement.
Using the Console to Monitor
The Administration Console offers some monitoring capabilities:
Monitoring Running Servers
Monitoring Individual Servers
Server Status and Threads Monitoring
Check out our Related Courses