This chapter provides detailed descriptions of custom WLST commands for logging, including command syntax, arguments and command examples. Use the logging commands to configure settings for log files and to view and search log files.
For additional details about configuring and searching log files, see "Managing Log Files and Diagnostic Data" in the Oracle Fusion Middleware Administrator's Guide.
Note:
To use these logging custom WLST commands, you must invoke the WLST script from the Oracle Common home. See "Using Custom WLST Commands" in the Oracle Fusion Middleware Administrator's Guide.
Table 7-1 describes the different categories of logging commands.
Table 7-1 Logging Command Categories
Command category | Description |
---|---|
Configure settings for log files, such as the level of information written to the file or the maximum file size. |
|
View Oracle Fusion Middleware log files and search log files for particular messages. |
|
Configure and use selective tracing, which specifies that messages are traced for specific server, loggers, or users. |
Use the commands in Table 7-2 to configure settings for log files, such as the level of information written to the file or the maximum file size. In the Use with WLST column, online means the command can only be used when connected to a running server. Offline means the command can only be used when not connected to a running server. Online or offline means the command can be used in both situations.
Table 7-2 Logging Configuration Commands
Use this command... | To... | Use with WLST... |
---|---|---|
Configure an existing log handler, add a new handler, or remove existing handlers. |
Online |
|
Get the level for a given logger. |
Online |
|
Get the list of loggers and the level of each logger. |
Online |
|
List the configuration of one of more log handlers. |
Online |
|
Set the level for a given logger. |
Online |
Command Category: Log Configuration
Use with WLST: Online
Configures an existing Java logging handler, adds a new handler, or removes an existing handler. It returns a java.util.List with one entry for each handler. Each entry is a javax.management.openmbean.CompositeData object describing the handler.
With this command, you can change the location of the log files, the frequency of the rotation of log files, and other log file properties.
configureLogHandler(options)
Argument | Definition |
---|---|
options
|
Comma-separated list of options, specified as name-value pairs. Valid options include:
|
options (continued)
|
|
The following table lists the properties for the quicktrace-handler. This handler allows you to trace messages from specific loggers and store the messages in memory. For more information, see "Configuring and Using QuickTrace" in the Oracle Fusion Middleware Administrator's Guide.
QuickTrace Property | Description |
---|---|
bufferSize |
The approximate size of the circular QuickTrace buffer, in which log records are stored in memory. Note that actual memory consumption may be less than, but not more than this value. |
enableDMSMetrics |
If specified as true, DMS metrics are enabled for the quicktrace-handler. The default is true. |
enableUserBuffer |
If specified as true, the handler maintains an individual buffer for each user specified in the reserveBufferUserID property. If the user is not defined in the reserveBufferUserID property, the messages are cached in the COMMON buffer. If specified as false, the handler maintains only one buffer, COMMON. The default is false. |
flushOnDump |
If specified as true, the buffer is flushed when you execute the executeDump command. The default is true. |
includeMessageArguments |
If specified as true, message arguments are included with the formatted log messages that have a message ID. The default is false. |
maxFieldLength |
The maximum length, in bytes, for each field in a message. The fields can include the message text, supplemental attributes, thread name, source class name, source method name, and message arguments. The default is 240 bytes. A small number can restrict the amount of information returned for a message. An excessively number can reduce the amount of log records in the buffer because each message uses more bytes. |
reserveBufferUserID |
A list of user IDs, separated by a comma. If enableUserBuffer is specified as true, any log messages related to the user are written to a separate buffer. |
supplementalAttributes |
A list of supplemental attribute names. The attributes are listed in the logging.xml file. Setting supplemental attributes requires additional memory or CPU time. |
useDefaultAttributes |
If specified as true, default attribute values are added to each log message. The default attributes are HOST_ID, HOST_NWADDR, and USER_ID. |
useLoggingContext |
If specified as true, the log message includes DMS logging context attributes. The default is false. If you enable this option, the trace requires additional CPU time. |
useRealThreadID |
If specified as true, the handler attempts to use the real thread ID instead of the thread ID that is provided by the jave.util.logging.logRecord. The default is false. If you enable this option, the trace requires additional CPU time. |
useThreadName |
If specified as true, the log message includes the thread name instead of the thread ID. The default is false. |
The following example specifies the maximum file size for the odl-handler:
configureLogHandler(name="odl-handler", maxFileSize="5M")
The following example specifies the rotation frequency for the odl-handler:
configureLogHandler(name="odl-handler", rotationFrequency="daily")
The following example specifies the rotation frequency and the retention period for the odl-handler. It also removes the properties maxFileSize and maxLogSize:
configureLogHandler(name="odl-handler", rotationFrequency="daily", retentionPeriod="week", removeProperty=['maxFileSize','maxLogSize'])
The following example configures the quicktrace-handler, adding the logger oracle.adf.faces, and enabling user buffers for user1 and user2:
configureLogHandler(name="quicktrace-handler", addToLogger="oracle.adf.faces", propertyName="enableUserBuffer", propertyValue="true", propertyName="reserveBufferUserID", propertyValue="user1, user2")
The oracle.adf logger is associated with the handlers odl-handler, wls-domain, and console-handler. When you set the level of the logger, these handlers will use the same level (TRACE:1) for the logger oracle.adf. As a result, much information will be written to the log files, consuming resources. To avoid consuming resources, set the level of the handlers to a lower level, such as WARNING or INFORMATION. For example:
configureLogHandler(name="odl-handler", level="WARNING:1") configureLogHandler(name="wls-domain", level="WARNING:1") configureLogHandler(name="console-handler", level="WARNING:1")
Command Category: Log Configuration
Use with WLST: Online
Returns the level of a given Java logger.
The returned value is a string with the logger's level, or None if the logger does not exist. An empty string indicates that the logger level is null.
getLogLevel(options)
Argument | Definition |
---|---|
options
|
Comma-separated list of options, specified as name-value pairs. Valid options include:
|
The following example returns the level for the logger oracle:
getLogLevel(logger='oracle')
The following example returns the level for the logger oracle, specifying only config loggers, not runtime loggers:
getLogLevel(logger='oracle', runtime=0)
The following example returns the level for the logger oracle on the Oracle WebLogic Server server2:
getLogLevel(logger='oracle', target='server2')
Command Category: Log Configuration
Use with WLST: Online
Lists Java loggers and their levels. The command returns a PyDictionary object where the keys are logger names and the associated values are the logger levels. An empty level is used to indicate that the logger does not have the level set.
listLoggers([options])
Argument | Definition |
---|---|
options
|
An optional comma-separated list of options, specified as name-value pairs. Valid options include:
|
The following example lists all of the loggers:
listLoggers()
The following example lists all of the loggers that start with the name oracle.*.
listLoggers(pattern="oracle.*")
The following example list all config loggers:
listLoggers(runtime=0)
The following example list all loggers for the WebLogic Server server1:
listLoggers(target="server1")
Command Category: Log Configuration
Use with WLST: Online
Lists Java log handlers configuration. This command returns a java.util.List with one entry for each handler. Each entry is a javax.management.openmbean.CompositeData object describing the handler.
listLogHandlers([options])
Argument | Definition |
---|---|
options
|
An optional comma-separated list of options, specified as name-value pairs. Valid options include:
|
Command Category: Log Configuration
Use with WLST: Online
setLogLevel(options)
Argument | Definition |
---|---|
options
|
Comma-separated list of options, specified as name-value pairs. Valid options include:
|
The following example sets the log level to NOTIFICATION:1 for the logger oracle.my.logger:
setLogLevel(logger="oracle.my.logger", level="NOTICATION:1")
The following example sets the log level to TRACE:1 for the logger oracle.my.logger and specifies that the level should be saved to the configuration file:
setLogLevel(logger="oracle.my.logger", level="TRACE:1", persist=0)
The following example sets the log level to WARNING for the config logger oracle.my.logger on the WebLogic Server server1:
setLogLevel(target="server1", logger="oracle.my.logger", level="WARNING", runtime=0)
Use the commands in Table 7-3 to view Oracle Fusion Middleware log files and to search log files for particular messages.
Table 7-3 Search and Display Commands
Use this command... | To... | Use with WLST... |
---|---|---|
List the logs for one or more components. |
Online or Offline |
|
Search and display the contents of log files. |
Online or Offline |
Command Category: Search and Display
Use with WLST: Online or Offline
Search and display the contents of diagnostic log files. The command returns a value only when the returnData option is set to true. By default it will not return any data. The return value depends on the option used.
displayLogs([searchString,][options])
Argument | Definition |
---|---|
searchString
|
An optional search string. Only messages that contain the given string (case-insensitive) will be returned. Note that the displayLogs command can read logs in multiple formats and it converts the messages to ODL format. The search will be performed in the native format, if possible. Otherwise, it may be performed in the message contents, and it may exclude mark-up. Therefore you should avoid using mark-up characters in the search string. |
options
|
An optional comma-separated list of options, specified as name-value pairs. Valid options include:
|
options (continued)
|
|
options (continued)
|
|
The following example displays the last 100 messages from all log files in the domain:.
displayLogs(tail=100)
The following example displays all messages logged in the last 15 minutes:
displayLogs(last='15m')
The following example displays log messages that contain a given string:
displayLogs('Exception')
The following example displays log messages that contain a given ECID:
displayLogs(ecid='0000Hl9TwKUCslT6uBi8UH18lkWX000002')
The following example displays log messages of type ERROR or INCIDENT_ERROR:
displayLogs(type=['ERROR','INCIDENT_ERROR'])
The following example displays log messages for a given Java EE application:
displayLogs(app="myApplication")
The following example displays messages for a system component, ohs1:
displayLogs(target="opmn:instance1/ohs1")
The following example displays a message summary by component and type:
displayLogs(groupBy=['COMPONENT_ID', 'MSG_TYPE'])
The following example displays messages for a particular time interval:
displayLogs(query="TIME from 11:15 and TIME to 11:20")
The following example shows an advanced query:
displayLogs(query="TIME from 11:15 and TIME to 11:20 and ( MSG_TEXT contains exception or SUPPL_DETAIL contains exception )")
A similar query could be written as:
displayLogs("exception", query="TIME from 11:15 and TIME to 11:20")
Command Category: Search and Display
Use with WLST: Online or Offline
Lists log files for Oracle Fusion Middleware components. This command returns a PyArray with one element for each log. The elements of the array are javax.management.openmbean.CompositeData objects describing each log.
listLogs([options]
Argument | Definition |
---|---|
options
|
An optional comma-separated list of options, specified as name-value pairs. Valid options include:
|
The following example lists all of the log files for the WebLogic domain:
listLogs()
The following example lists the log files for the WebLogic Server server1:
listLogs(target="server1")
The following example lists the log files for the Oracle HTTP Server ohs1:
listLogs(target="opmn:instance1/ohs1")
The following example, used in disconnected mode, lists the log files for the WebLogic Server server1:
listLogs(oracleInstance="/middleware/user_projects/domains/base_domain", target="server1")
Use the commands in Table 7-4 to configure and use selective tracing. Selective tracing provides fine-grained logging for specified users or other properties of a request. In the Use with WLST column, online means the command can only be used when connected to a running server.
Use this command... | To... | Use with WLST... |
---|---|---|
Configures one or more loggers for selective tracing. |
Online |
|
Lists the active traces. |
Online |
|
Lists the loggers that support selective tracing. |
Online |
|
Starts a selective tracing sessions. |
Online |
|
Stops one or more selective tracing sessions. |
Online |
Command Category: Tracing
Use with WLST: Online
Configures one or more loggers for selective tracing. This command also enables or disables a logger for selective tracing.
configureTracingLoggers([options])
Argument | Definition |
---|---|
options
|
A comma-separated list of options, specified as name-value pairs. Valid options are:
|
The following example configures selective tracing for all loggers beginning with oracle.security
:
configureTracingLoggers(pattern='oracle.security.*', action="enable")
Configured 62 loggers
The following example disables selective tracing for all loggers:
configureTracingLoggers(action="disable")
Configured 1244 loggers
Command Category: Tracing
Use with WLST: Online
listActiveTraces([options])
Argument | Definition |
---|---|
options
|
A comma-separated list of options, specified as name-value pairs. Valid options are:
|
The following example lists the active traces:
listActiveTraces()
-------------------------------------+----------+-----------+------+-----------+-----------
Trace ID |Attr. Name|Attr. Value| Level| Exp. Time |Description
-------------------------------------+----------+-----------+------+-----------+-----------
a9580e65-13c4-420b-977e-5ba7dd88ca7f |USER_ID |user1 | FINE | |
a04b47f7-2830-4d80-92ee-ba160cdacf6b |USER_ID | user2 | FINE | |
Command Category: Tracing
Use with WLST: Online or Offline
Lists the loggers that support selective tracing. This command displays a table of logger names and their tracing status. The status enabled
means that the logger is enabled for tracing on all servers. The status disabled
means that the logger is disabled for tracing on all servers. The status mixed
means that the logger is enabled for tracing on some servers, but disabled on others.
listTracingLoggers([options])
Argument | Definition |
---|---|
options
|
A comma-separated list of options, specified as name-value pairs. Valid options are:
|
The following example lists all tracing loggers beginning with oracle.security
:
listTracingLoggers(pattern="oracle.security.*")
------------------------------------------------------------------+--------
Logger | Status
------------------------------------------------------------------+--------
oracle.security | enabled
oracle.security.audit.logger | enabled
oracle.security.jps.az.common.util.JpsLock | enabled
.
.
.
Command Category: Tracing
Use with WLST: Online
Starts a new selective tracing session for a specified user or DMS context attribute at a specified level of tracing.
startTracing([options])
Argument | Definition |
---|---|
options
|
A comma-separated list of options, specified as name-value pairs. Valid options are:
|
Command Category: Tracing
Use with WLST: Online
stopTracing([options])
Argument | Definition |
---|---|
options
|
A comma-separated list of options, specified as name-value pairs. Valid options are:
|