Oracle Application Server components generate log files containing messages that record all types of events, including startup and shutdown information, errors, warning messages, access information on HTTP requests, and additional information. This chapter describes how to view and manage log files to assist in monitoring system activity and in diagnosing system problems.
It contains the following topics:
Listing and Viewing Log Files with Application Server Control
Understanding Oracle Application Server Logging
Diagnosing Problems and Correlating Messages
Advanced Logging Topics
With the Application Server Control Console, you can list and search log files across Oracle Application Server components. You can view log files from the Application Server Control Console pages or download a log file to your local client and view the log files using another tool.
This section covers the following:
Viewing Log Files
Listing Log Files for Components
Searching Log Files and Viewing Messages
Using Regular Expressions with Search
You can view the log files for a specific component with Application Server Control Console:
Navigate to the Application Server Home page, then select the Logs link. The Log Files page is displayed.
You can choose to view application logs, diagnostic logs, management system logs, or Web services log, or all types of logs by selecting a option from the View menu.
In the table, expand items until you see a list of log files for the component. For example, expand Components, expand Content DB and Configuration Assistant. The log files are listed in the table, as shown in Figure 5-1.
For any particular log file, click View. The log file text is displayed.
You can list the log files for individual components, some components, or all components by using the Application Server Control Console. To list the log files, perform the following steps:
Navigate to the Application Server Home page, then select the Logs link. The Log Files page is displayed.
You can choose to view application logs, diagnostic logs, management system logs, or Web services log, or all types of logs by selecting them from the View menu.
To view all components, select Components in the table. To view some components, expand the Components item, then expand items under Components until you reach the level you want. Then, select those components.
Click Search to list the log files for the selected components.
On the Search Logs page, which is displayed when the search returns, click Show Selected Log Files. The Search Logs page shows the names of the log files.
You can filter the search for log files by certain log file attributes by using the Search Logs page of the Application Server Control Console.
Take the following steps:
Navigate to the Application Server Home page, then select the Logs link. The Log Files page is displayed.
Select the type of log files by selecting it in the View menu.
To view the log files of specific components, select them in the table.
Click Search. The Search Logs page is displayed.
Specify the Search criteria, such as Date Range or Message Type.
Click Advanced Search Options to display the Filter by Log Message Fields table.
Select a field from the Log Message Field list.
Click Add Row to add a row for the selected log message field.
Enter the desired search value in the Value field.
To indicate this is a regular expression, click Regular Expression. (See Section 5.1.4 for information about regular expressions.)
If you want to select additional fields with values, click Add Another Row and enter additional values.
Click Search to perform the search. When the search returns, the Results section shows log files with matching fields, as shown in Figure 5-2.
To view a log entry, click Show in the Details column of the Results area on the Search Logs page.
The details of the error message are displayed. This information includes the Component Name and ID, Message Level, Message Type, Message Text, Module ID, and optionally the Execution Context ID (ECID).
Regular expression matching is applied when you select the check box in the Regular Expression field on the Search Logs page. You can specify a regular expression for the Message Text field and for the Filter by Log Message Fields table. Using a regular expression in a search enables you to enter a pattern description to match strings for a search.
The search uses the Apache Jakarta regular expression engine, which uses "*" for a string of characters, "?" for a single character, and supports boundary matches, including "^" for a match only at the beginning of an entry, and "$" for a match only at the end of an entry, and special characters, including "t" for Tab, "n" for newline, "r" for return, and "f" for form feed.
See Also:
http://jakarta.apache.org/regexp for more information on supported regular expressionsThis section provides information about message formats and log file naming and explains how to configure logging options for components. This section covers the following topics:
Understanding Log File Formats and Naming
Configuring Component Logging Options
Log files of Oracle Application Server components use either text-based formatting or Oracle Diagnostic Logging (ODL).
Using ODL, log file naming and the format of the contents of log files conforms to an Oracle standard and the diagnostic messages are written in XML. Some Oracle Application Server components do not use ODL, and write their diagnostic messages using a component-specific text format. Other components support ODL, but do not enable ODL by default.
Regardless of the format, ODL or text-based, of the messages that are stored in log files, you can view log files using the Application Server Control Console, or you can download log files to your local client and view them using another tool (for example a text editor, or another file viewing utility).
This section covers the following topics:
ODL Message Formatting and ODL Log File Naming
Log File Message Formats by Component
Note:
Some Oracle Application Server components do not support ODL. Other components support ODL, but do not enable ODL by default.When Oracle Application Server components run and produce ODL messages, the messages are written to diagnostic log files using XML format. Each ODL message includes a HEADER element containing fields with information about the message, optionally a CORRELATION_DATA element containing information to assist in correlating messages across components, and a PAYLOAD element containing the message text, including optional arguments and associated values.
Using ODL, Oracle Application Server components write diagnostic log files to a logging directory and determine the names for logging directories using a component-specific naming convention.
See Also:
Section 5.4.1, "Understanding ODL Messages and ODL Log Files"
Section 5.3.1, "Correlating Messages Across Log Files and Components"
Table 5-1 lists the supported message formats for each Oracle Application Server component. Several components optionally support ODL format, where ODL is not the default format.
Table 5-1 Diagnostic Message Format by Component
Component | Default Format | ODL Support | LocationFoot 1 |
---|---|---|---|
Application Server Control Console |
Text |
No |
|
Content DB: node log |
Text |
No |
|
Content DB: application logs |
Text |
Yes |
|
HTTP Server |
Text |
Yes |
|
OC4J instance_name |
Text |
Yes |
|
OC4J instance_name |
ODL |
Yes |
|
OPMN |
Text |
No |
|
Port Tunneling |
Text |
No |
|
Universal Installer |
Text |
No |
|
WebCenter: application logs |
Text |
Yes |
|
Footnote 1 Locations are shown in UNIX format. Invert the slashes for Windows format.
Administrators can configure logging options to manage and limit the logging information that Oracle Application Server components generate and save.
For example, to configure logging options for OC4J components using Java logging, you modify the j2ee-logging.xml
file, which is installed in the ORACLE_HOME/j2ee/home/config directory. See the chapter, "Logging in OC4J" in the Oracle Containers for J2EE Configuration and Administration Guide for more information.
The logging configuration options for components include:
Specifying log file names and pathnames: Most Oracle Application Server components let you specify the directory for storing diagnostic log files. Specifying the diagnostic logging directory allows administrators to manage system and network resources.
Limiting log file size: As Oracle Application Server components run and generate diagnostic messages, the size of the log files increases. Oracle Application Server components use one of several strategies to deal with log file size. Some components allow log files to keep increasing in size; in this case, it is the administrator's responsibility to monitor and clean up the log files. Other components, including OC4J, let you specify configuration options that limit how much log file data is collected and saved.
Using log file archiving: Certain Oracle Application Server components let you specify configuration options to control the size of diagnostic logging directories. This lets you determine a maximum size for the directories containing a component's log files. When the maximum size is reached, older logging information is deleted before newer logging information is saved.
Setting component logging levels: Certain Oracle Application Server components, including Oracle HTTP Server, allow administrators to configure logging levels. By configuring logging levels, the number of messages saved to diagnostic log files can be reduced. For example, you can set the logging level so that the system only reports and saves critical messages.
See Also:
Section A.4, "Configuring Logging for Application Server Control"
Oracle Application Server component documentation for information on setting logging configuration options
Generally, administrators and others view log file data to diagnose, monitor, and search for component errors or problems that may cause component errors. The Application Server Control Console supports a unified architecture and provides cross-component tools that can assist you in these tasks.
This section covers the following topics:
Correlating Messages Across Log Files and Components
Diagnosing Component Problems
Certain Oracle Application Server components provide message correlation information for diagnostic messages. Message correlation information helps those viewing diagnostic messages determine relationships between messages across components. The Execution Context ID (ECID) is a globally unique identifier associated with a thread of execution. The ECID helps you to use log file entries to correlate messages from one application or across application server components. By searching related messages using the message correlation information, multiple messages can be examined and the component that first generates a problem can be identified (this technique is called first-fault component isolation). Message correlation data can help establish a clear path for a diagnostic message across components, within which errors and related behavior can be understood.
When you view an entry on the Log Message Details page in the Application Server Control Console, if the ECID field is available, it displays the Execution Context ID as a link. Selecting the Execution Context ID link shows you all the diagnostic messages in the Log Repository with the same ECID.
You can use the ECID to track requests as they move through Oracle Application Server.
The ECID takes the following format:
request_id, sequence_number
The request_id
is a unique string that is associated with each request.
The sequence_number
represents the hop number of the request, as it passes through Oracle Application Server (or through the component).
For example, Oracle HTTP Server assigns an initial sequence number of 0 to a request. After that, the sequence number is incremented as the request moves through Oracle Application Server components.
Table 5-2 lists the Oracle Application Server components that provide message correlation information (using an ECID), and specifies if a component supports message correlation, but it is not enabled by default.
Table 5-2 Oracle Application Server Components Supporting Message Correlation
Component | Support for Message Correlation |
---|---|
OC4J |
Supports message correlation. |
HTTP Server |
Supports message correlation. |
When an Oracle Application Server component has a problem, you can isolate and determine the cause of the problem by viewing the diagnostic messages. The following general techniques can assist you in accomplishing this task:
Search for errors or warnings related to the problem
Correlate the errors across components
Correlate the errors across a time interval
Perform component-based analysis
This section covers the following topics:
Understanding ODL Messages and ODL Log Files
Component Diagnostic Log File Registration
Configuring Components to Produce ODL Messages
Managing OC4J Redirected stderr and stdout Files
Configuration Issue for Log Files
This section covers the following topics:
ODL Message Contents
ODL Log File Rotation and Naming
Using ODL, diagnostic messages are written to log files using XML format and each message includes a HEADER element containing information about the message, optionally a CORRELATION_DATA element containing information to assist in correlating messages across components, and a PAYLOAD element containing the message text including optional arguments and associated values.
Example 5-1 shows a sample ODL format message that includes the optional CORRELATION_DATA element.
Example 5-1 Sample ODL Message Content
2006-10-19T12:52:16.821-07:00
j2ee
1
sta.oracle.com
146.87.8.203
security
10
oracle
146.87.8.203:41990:1161287536821:00
[RealmLoginModule] authentication failed
Table 5-3 describes the contents of an ODL message header. For any given component that produces ODL format messages, the optional header fields may not be present in the generated diagnostic messages.
Table 5-3 ODL Format Message Header Fields
Header Field Name | Description | Required |
---|---|---|
|
The product or component ID for the component that originated the message. |
Required |
|
The DNS host network ID. |
Optional |
|
The IP or other network address for the originating host. |
Optional |
|
The ID of the client or security group to which the message relates. |
Optional |
|
The ID for the module that originated the message. |
Optional |
|
The name of the group to which the message belongs, for purposes of selecting similar messages. |
Optional |
|
The message ID. The message ID uniquely identifies the message. |
Optional |
|
An integer value that qualifies the message type ( |
Optional |
|
The type of the message. Possible values are: |
Required |
|
The organization ID for the originating component. This is usually the domain name for the organization. |
Optional |
|
The process ID for the process, or execution unit associated with the message. Java components may use this field to specify the process ID and the thread ID, or only the thread ID. |
Optional |
|
The timestamp normalized for clock drift across hosts. This field is used when the diagnostic message is copied to a repository in a different hosts. |
Optional |
|
The timestamp with local time zone. This specifies the date and time when the message was generated. |
Required |
|
The User ID associated with the message. |
Optional |
Using ODL provides the following benefits:
The capability to limit the total amount of diagnostic information saved.
Older segment files are removed and newer segment files are saved in chronological fashion.
Components can remain active, and do not need to be shutdown, when diagnostic logging files are cleaned.
Using ODL, Oracle Application Server components write diagnostic log files to a logging directory. Components determine the names for logging directories using a component-specific naming convention.
An ODL log is a set of log files that includes the current ODL log file, typically named log.xml
, and zero or more ODL Archives (segment files) that contain older messages. As the log file grows, new information is added to the end of the log file, log.xml
. When the log file reaches the rotation point, it is renamed and a new log file, log.xml
is created. (You specify the rotation point, by specifying the maximum ODL segment size, and, for some OC4J logs, the rotation time and rotation frequency using component-specific configuration options.)
Note:
Some Oracle Application Server components, in particular Oracle HTTP Server, do not support the ODL log file naming mechanism that this section describes. In Oracle HTTP Server, ODL diagnostic messages are written to a file,log.xml
, that does not have a configurable size limit.
Segment files are created when the ODL log file log.xml
reaches the rotation point. That is, the log.xml
is renamed to log
n
.xml
, where n
is an integer, and a new log.xml
file is created when the component generates new diagnostic messages.
Size-Based Log Rotation
To limit the size of the ODL log, components use a configuration option specifying the maximum size of the logging directory. Whenever the sum of the sizes of all of the files in the directory reaches the maximum, the oldest archive is deleted to keep the total size under the specified limit.
Note:
The most recent segment file is never deleted.For example, when the maximum directory size is reached, with the starting segment file named log9872
, the following files could be present in the log file directory:
File Size
log.xml 10002
log9872.xml 15000
log9873.xml 15000
log9874.xml 15000
log9875.xml 15000
log9876.xml 15000
In this case, when log.xml
fills up, log9872.xml
is removed and log.xml
is moved to the new file log9877.xml
. New diagnostic messages then are written to a new log.xml
.
For example, to specify the maximum ODL segment size and maximum directory size for an OC4J application named petstore, you would add the following entry to the file ORACLE_HOME/j2ee/instance_name/application-deployments/petstore/orion-application.xml:
For OC4J components that are configured in the j2ee-logging.xml file, you can specify a rotation time and rotation frequency, in addition to a maximum segment size and directory size.
Time-Based Log Rotation
You specify the following properties in the element:
baseRotationTime: (Optional.) The base time for the rotation. The format for the base time can be any of the following:
hh:mm
, for example, 04:20. This format uses the local timezone.
yyyy-MM-dd
, for example, 2006-08-01. This format uses the local timezone.
yyyy-MM-ddThh:mm
, for example 2006-08-01T04:20. This format uses the local timezone.
yyyy-MM-ddThh:mm:ss.sTZD
, where TZD is the timezone indicator. TZD can be Z
, indicating UTC, or {+|-}hh:mm
. For example, 2006-03-01T04:20:00-08:00 represents March 1, 2006 4:20:00 in US Pacific Standard Time timezone.
If you do not specify baseRotationTime, the default value is Jan. 1, 1970, 00:00 UTC.
rotationFrequency: The frequency of the rotation, in minutes. In addition, you can specify one of the following values: hourly, daily, weekly.
You specify these properties in the following file:
ORACLE_HOME/j2ee/instance_name/config/j2ee-logging.xml
For example, to specify that the log files are rotated every day at 4:00AM local time, or when they reach 2000000 bytes in size, use the following:
The Application Server Control Console reads Oracle Application Server component diagnostic registration files to determine names, locations, and additional configuration information about diagnostic log files. The following directory contains the diagnostic log file registration files:
ORACLE_HOME/j2ee/instance/applications/ascontrol/ascontrol/WEB-INF/config/registration
Oracle Application Server components may have multiple registration files in the configuration registration directory.
The format for the registration files includes an Oracle Application Server component ID, and the extension .xml
. Table 5-4 lists the Oracle Application Server components and their associated IDs.
Note:
Components are responsible for creating the component diagnostic registration files. Normally, Oracle Application Server administrators should not modify these files.Table 5-4 Component IDs for Diagnostic Log File Configuration
Component Name | Component ID |
---|---|
Enterprise Manager |
EM |
Oracle HTTP Server |
OHS |
OC4J |
OC4J |
OPMN |
OPMN |
Port Tunneling |
IASPT |
Oracle Content DB |
CONTENT |
Oracle Universal Installer |
OUI |
Web Services |
WEBSERVICES |
This section covers the following topics:
Configuring Oracle HTTP Server to Produce ODL Messages
Configuring OC4J to Produce ODL Messages
Table 5-5 lists the Oracle Application Server components that support ODL messages but that generate text messages by default. By making configuration changes, you can configure these components to produce ODL messages. (Table 5-1 lists the Oracle Application Server components that produce ODL messages.)
Table 5-5 Oracle Application Server Components with Configuration Options for Supporting ODL
Component | Default Format | ODL Support | LocationFoot 1 |
---|---|---|---|
HTTP Server |
Text |
Yes |
ORACLE_HOME/Apache/Apache/logs |
OC4J Instance |
Text |
Yes |
Applications deployed into OC4J: ORACLE_HOME/j2ee/application-deployments/application_name/application.log Note: the following OC4J log files use ODL by default: OC4J components using Java logging, OPMN-managed: ORACLE_HOME/j2ee/instance_name/log/instance_group_process/oc4j/log.xml OC4J components using Java logging, standalone OC4J: ORACLE_HOME/j2ee/instance_name/log/oc4j/log.xml See "Logging in OC4J" in Oracle Containers for J2EE Configuration and Administration Guide for a complete list of log files. |
Footnote 1 Locations are shown in UNIX format. Invert the slashes for Windows format.
To configure Oracle HTTP Server to produce ODL messages, perform the following steps:
Add a directory named oracle
where the Oracle HTTP Server ODL messages will be stored. Create the directory as a subdirectory of the following:
(UNIX) ORACLE_HOME/Apache/Apache/logs
(Windows) ORACLE_HOMEApacheApachelogs
Modify the httpd.conf
file to set the value of the OraLogMode and OraLogSeverity directives. The file is located in the following directory:
(UNIX) ORACLE_HOME/Apache/Apache/conf/httpd.conf
(Windows) ORACLE_HOMEApacheApacheconfhttpd.conf
For example:
OraLogMode oracle
OraLogSeverity NOTIFICATION
Restart the middle-tier instance.
See Also:
Oracle HTTP Server Administrator's Guide for details on using the OraLogMode and OraLogSeverity directivesTo enable ODL logging, you add a new element, the element, within the element in any of the OC4J log file configuration files. For example, to enable ODL logging for an application named petstore, you would add the following entry to the file ORACLE_HOME/j2ee/instance_name/application-deployments/petstore/orion-application.xml:
See Also:
The chapter "Logging in OC4J" in Oracle Containers for J2EE Configuration and Administration Guide for more information, including a list of configuration filesYou can set runtime options for OC4J log files that specify that redirected stderr
and stdout
log files be rotated when the files reach a specific size or at the particular time of day. You can also specify the maximum number of log files to keep as archives. The following example specifies that the stdout
log file will be rotated at 1:30 AM each day and that the maximum number of log files is 10:
java -Dstdstream.rotatetime=1:30 -Dstdstream.filenumber=10 -jar oc4j.jar -out d:logsoc4j.out
See Also:
Oracle Containers for J2EE Configuration and Administration Guide for more informationThe Logs link in the Application Server Control Console gives you an integrated view of many Oracle Application Server component log files. However, certain log files are only available at the component level. Oracle Application Server components use the following directory to make their log files visible to the Application Server Control Console:
ORACLE_HOME/j2ee/home/applications/ascontrol/ascontrol/WEB-INF/config/registrationSome Oracle Application Server component log files are not exposed through Application Server Control Console pages.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/678020/viewspace-1044308/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/678020/viewspace-1044308/