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

Indicates whether or not Content Server is able to compress log files.

GetLog4cxxSettings( String configFileName )

Internal function used to access the contents of the Content Server logging properties file.

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

Gets the name of the logger registered for the current thread.

LogLevelToString( Integer logLevel )

Gets a string description for the given log level.

Notifies Content Server that a database upgrade is not needed nor in progress.

Forces a reload of the log settings.

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

CanCompressLogs

Boolean CanCompressLogs()

Indicates whether or not Content Server is able to compress log files. This is based on the presence of a gzip or zip command within the executable path available to Content Server.

Returns:

A Boolean indicating whether Content Server is able to compress log files.

GetLog4cxxSettings

Assoc GetLog4cxxSettings( String configFileName )

Internal function used to access the contents of the Content Server logging properties file.

The intention of this built-in function is for migration of settings from the "contentserver.logging.properties" file to the "opentext.ini" configuration file.

Parameters

configFileName

Path to the "contentserver.logging.properties" configuration file.

Returns:

An Assoc containing the configuration settings.

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.

GetThreadLoggerName

String GetThreadLoggerName()

Gets the name of the logger registered for the current thread.

Returns:

The name of the thread logger.

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.

NotifySystemInitialized

Integer NotifySystemInitialized()

While a database upgrade is needed or in progress, the following changes are in effect for connect and thread logs:

  • If the log level was at a level less detailed than INFO, Content Server sets it to INFO.
  • Rolling is disabled.
  • The value of opentext.ini's "general" section's NumOldLogs setting is ignored such that, on each restart, Content Server appends messages to the same files instead of overwriting the files from past runs.

This function notifies Content Server that a database upgrade is not needed nor in progress, so that Content Server can reset these settings to the values in opentext.ini. Individual OScript developers should not need to call this function, as it is already called where needed.

Returns:

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

ResetLog

Integer ResetLog()

Forces the current thread logger to reload its configuration settings.

Returns:

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

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 © 2023 OpenText Corporation. All rights reserved.