7.2 Search and Display Commands

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...

displayLogs

List the logs for one or more components.

Online or Offline

listLogs

Search and display the contents of log files.

Online or Offline


7.2.1 displayLogs

Command Category: Search and Display

Use with WLST: Online or Offline

Description

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.

Syntax

displayLogs([searchString,][target] [, oracleInstance] [, log] [, last] [, tail]
[, pattern] [, ecid] [, component] [, module] [, type] [, app] [, query] [, groupBy]
[, orderBy [, returnData] [, format] [, exportFile] [, follow])

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.

target

Optional. The name of a WebLogic Server instance, or a system component.

For a system component, the syntax for the target is:

sc:component-name

In connected mode, the default target is the WebLogic domain. In disconnected mode, there is no default; the target option is required.

oracleInstance

Optional. Defines the path to the ORACLE_INSTANCE or WebLogic domain home. The command is executed in disconnected mode when you use this parameter.

log

Optional. A log file path. The command will read messages from the given log file. If the log file path is not given, the command will read all logs associated with the given target.

last

Optional. An integer value. Restricts the search to messages logged within the last minutes. The value can have a suffix s (second), m (minute), h (hour), or d (day) to specify a different time unit. (For example, last='2h' will be interpreted as the last 2 hours).

tail

Optional. An integer value. Restrict the search to the last n messages from each log file and limits the number of messages displayed to n.

pattern

Optional. A regular expression pattern. Only messages that contain the given pattern are returned. Using the pattern option is similar to using the searchString argument, except that you can use a regular expression.

The regular expression pattern search is case sensitive (unless you explicitly turn on case-insensitive flags in the pattern). The pattern must follow java.util.regex syntax.

ecid

Optional. A string or string sequence containing one or more Execution Context ID (ECID) values to be used as a filter for log messages.

component

Optional. A string or string sequence containing one or more component ID values to be used as a filter for log messages.

module

Optional. A string or string sequence containing one or more module ID values to be used as a filter for log messages.

type

Optional. A string or string sequence containing one or more message type values to be used as a filter for log messages.

app

Optional. A string or string sequence containing one or more application values to be used as a filter for log messages.

query

Optional. A string that specifies an expression used to filter the contents of log messages.

A simple expression has the form:

field-name operator value

where field-name is a log record field name and operator is an appropriate operator for the field type (for example, you can specify equals, startsWith, contains or matches for string fields).

A field name is either one of the standard ODL attribute names (such as COMPONENT_ID, MSG_TYPE, MSG_TEXT, and SUPPL_DETAIL), or the name of a supplemental attribute (application specific), prefixed by SUPPL_ATTR. (For example, SUPPL_ATTR.myAttribute).

A few common supplemental attributes can be used without the prefix. For example, you can use APP to filter by application name.

You can combine multiple simple expressions using the boolean operators and, or and not to create complex expressions, and you can use parenthesis for grouping expressions.

See Administering Oracle Fusion Middleware for a detailed description of the query syntax.

groupBy

Optional. A string list. When the groupBy option is used, the output is a count of log messages, grouped by the attributes defined in the string list.

orderBy

Optional. A string list that defines the sort order for the result. The values are log message attribute names. The name may be extended with an optional suffix :asc or :desc to specify ascending or descending sorting. The default sort order is ascending.

By default, the result is sorted by time.

returnData

Optional. A Jython boolean value (0 or 1). If the value is true the command will return data (for example, to be used in a script). The default value is false, which means that the command only displays the data but does not return any data.

format

Optional. A string defined the output format. Valid values are ODL-Text, ODL-XML, ODL-complete and simple. The default format is ODL-Text.

exportFile

Optional. The name of a file to where the command output is written. By default, the output is written to standard output.

follow (f)

Optional. Puts the command in "follow" mode so that it continues to read the logs and display messages as new messages are added to the logs (similar to the UNIX tail -f command). The command will not return when the f option is used. This option is currently not supported with system components.


Examples

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="sc: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")

7.2.2 listLogs

Command Category: Search and Display

Use with WLST: Online or Offline

Description

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.

Syntax

listLogs([target] [, oracleInstance] [, unit] [, fullTime]

Argument Definition
target

Optional. The name of a WebLogic Server instance, or an Oracle Fusion Middleware system component.

For a system component, the syntax for the target is:

sc:component-name

In connected mode, the default target is the WebLogic domain.

In disconnected mode, there is no default; the target option is required.

oracleInstance

Optional. Defines the path to the ORACLE_INSTANCE or WebLogic domain home. The command is executed in disconnected mode when you use this parameter.

unit

Optional. Defines the unit to use for reporting file size. Valid values are B (bytes), K (kilobytes), M (megabytes), G (gigabytes), or H (display size in a human-readable form, similar to the UNIX ls -h option). The default value is H.

fullTime

Optional. A Jython Boolean value. If true, reports the full time for the log file last modified time. Otherwise, it displays a short version of the time. The default value is false.


Examples

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="sc:ohs1")

The following example, used in disconnected mode, lists the log files for the WebLogic Server server1:

listLogs(oracleInstance="/scratch/Oracle/domains/base_domain",
           target="server1")