OScript API/Built-in Package Index

Class: Logging

This API will allow a developer to configure and use logging in Content Server.

Class Attributes

The logger name prefix for all Content Server loggers.

All message levels will be logged.

Only DEBUG log messages and higher will be logged.

Only ERROR log messages and higher will be logged.

Only FATAL log messages will be logged.

Only INFO log messages and higher will be logged.

Log level output is disabled. Nothing will be logged.

Only TRACE log messages and higher will be logged.

Only WARN log messages and higher will be logged.

Success return constant.

Class Methods

GetLoggerNames( String loggerPrefix, Boolean collapse )

Gets the master list of loggers defined in Content Server.

GetLogLevel( String loggerName )

Gets the current level for the given logger (LEVEL_OFF if the logger doesn't exist).

LogLevelToString( Integer logLevel )

Gets a string description for the given log level.

SetLogLevel( String loggerName, Integer logLevel )

Sets the current level for the given logger.

Class Attributes

The logger name prefix for all Content Server loggers.

Integer LEVEL_ALL

Messages for all log levels will be logged.

Integer LEVEL_DEBUG

Only DEBUG log messages and higher will be logged. Debug level is reserved for internal debugging messages. Enabling this level could have a severe impact on program performance.

Integer LEVEL_ERROR

Only ERROR log messages and higher will be logged.

Integer LEVEL_FATAL

Only FATAL log messages will be logged.

Integer LEVEL_INFO

Only INFO log messages and higher will be logged.

Integer LEVEL_OFF

Log level output is disabled. Nothing will be logged.

Integer LEVEL_TRACE

Only TRACE log messages and higher will be logged. Trace level is reserved for internal function-level trace debugging. Enabling this level will have a severe impact on program performance.

Integer LEVEL_WARN

Only WARN log messages and higher will be logged.

Integer OK

Success return constant.

Class Methods

GetLoggerNames

List GetLoggerNames( String loggerPrefix,
                     Boolean collapse )

Gets the master list of loggers defined in Content Server.

Parameters

loggerPrefix

The prefix logger name to match (for example, "com.opentext.contentserver" would match any logger name that started with this string.

collapse

True if logger names containing numbers should be collapsed, false if each should be returned separately.

For example, application.logger.[1], application.logger.[2] are defined in the system. If collapse is true, the logger list will only contain application.logger.

Returns:

A List containing the logger names if successful. If the function fails, an error code will be returned.

GetLogLevel

Integer GetLogLevel( String loggerName )

Gets the current level configured for the given logger.

Parameters

loggerName

The name of the logger to get the current level for.

Returns:

An Integer representing the current log level. Logging.LEVEL_OFF if the logger doesn't exist.

LogLevelToString

String LogLevelToString( Integer logLevel )

Gets a (localized) description string for a given log level.

Parameters

logLevel

The log level to get a description for.

Returns:

A String representation of the given log level.

SetLogLevel

Integer SetLogLevel( String loggerName,
                     Integer logLevel )

Sets the log level for the given logger.

Parameters

loggerName

The name of the logger whose level is to be set.

logLevel

The level to set.

Returns:

Logging.OK (Integer zero) if successful; Error otherwise.

 Copyright © 2019 OpenText Corporation. All rights reserved.