Description Syntax Examples setLogLevel

Logging Custom WLST Commands 7-7

7.1.4 listLogHandlers

Command Category: Log Configuration Use with WLST: Online

7.1.4.1 Description

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.

7.1.4.2 Syntax

listLogHandlers[options]

7.1.4.3 Examples

The following example lists all log handlers: listLogHandlers The following example lists all log handlers named odl-handler: listLogHandlersname=odl-handler The following example lists all log handlers for the WebLogic Server server1: listLogHandlerstarget=server1

7.1.5 setLogLevel

Command Category: Log Configuration Use with WLST: Online

7.1.5.1 Description

Sets the level of information written by a given Java logger to a log file.

7.1.5.2 Syntax

setLogLeveloptions Argument Definition options An optional comma-separated list of options, specified as name-value pairs. Valid options include: ■ target —The name of a WebLogic Server instance, or a string describing a system component. For system components, refer to the components documentation for details. The default value is the server to which WLST is connected. ■ name —The name of a log handler. If the name is not provided, then all handlers are listed. 7-8 Oracle Fusion Middleware WebLogic Scripting Tool Command Reference

7.1.5.3 Examples

The following example sets the log level to NOTIFICATION:1 for the logger oracle.my.logger: setLogLevellogger=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: setLogLevellogger=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: setLogLeveltarget=server1, logger=oracle.my.logger, level=WARNING, runtime=0 Argument Definition options Comma-separated list of options, specified as name-value pairs. Valid options include: ■ target —The name of a WebLogic Server instance, or a string describing a system component. For system components, refer to the components documentation for details. The default value is the server to which WLST is connected. ■ logger —A logger name. An empty string denotes the root logger. This option is required and has no default. The command throws an exception if the logger does not exist, unless the addLogger option is also used. ■ addLogger —A Jython boolean value 0 or 1 that determines if the logger should be created if it does not exist. This option is deprecated for runtime mode. Adding a runtime logger may have no effect because the logger may be garbage collected. If you need to set the level for a logger that has not yet been created, use the persist mode. ■ level —The level name. It can be either a Java level or an ODL level. Some valid Java levels are: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, OR FINEST. Valid ODL levels include a message type followed by a colon and a message level. The valid ODL message types are: INCIDENT_ ERROR, ERROR, WARNING, NOTIFICATION, TRACE, and UNKNOWN. The message level is represented by an integer value that qualifies the message type. Possible values are from 1 highest severity through 32 lowest severity. This option is required; there is no default value. ■ runtime —A Jython boolean value 0 or 1 that determines if the operation is to list runtime loggers or config loggers. The default value is 1 runtime. If the target is a system component that does not support changing runtime loggers, this option is ignored. Note: Because runtime loggers may be garbage collected, you should change the level of the runtime logger only if you know that the logger exists and that there is a strong reference to the logger. If the logger is garbage collected, any changes made to the logger level in runtime mode that are not persisted may be lost. ■ persist —A Jython boolean value 0 or 1 that determines if the level should be saved to the configuration file. The default value is 1. Logging Custom WLST Commands 7-9

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.

7.2.1 displayLogs

Command Category: Search and Display Use with WLST: Online or Offline

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

7.2.1.2 Syntax

displayLogs[searchString,][options] 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 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: ■ target —The name of a WebLogic Server instance, or a system component. For a system component, the syntax for the target is: opmn:instance-namecomponent-name In connected mode, the default target is the WebLogic domain. In disconnected mode, there is no default; the target option is required. ■ oracleInstance —Defines the path to the ORACLE_INSTANCE or WebLogic domain home. The command is executed in disconnected mode when you use this parameter. ■ log —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.