%LOG4SAS_LOGGER Autocall Macro

Defines a logger.
Category: Logging
Requirements: The MAUTOSOURCE system option must be set.
The %LOG4SAS autocall macro must be invoked before this macro is invoked to initialize SAS logging.

Syntax

%LOG4SAS_LOGGER(name<, "<ADDITIVITY=TRUE | FALSE>
<APPENDER-REF=(appender-list)> <LEVEL=level> ">
)

Syntax Description

name
specifies the name of the logger.
Tip You can specify the root logger by setting name equal to either two double quotation marks with no space between them (" "), or to "root". If you specify the root logger, these settings are in effect only during the lifespan of the DATA step. Root setting before and after the DATA step are based on the logging configuration file.
ADDITIVITY=TRUE | FALSE
specifies whether to pass log events to only the appender that is associated with the logger or to all of the appenders in the logger's hierarchy.
Restriction ADDITIVITY can be modified for a logger only if the logger’s IMMUTABILITY option in the logging configuration file is set to FALSE. If you cannot modify a logger’s ADDITIVITY option, contact your system administrator.
APPENDER-REF=(appender-list)
specifies one or more appender names to which log events are passed.
Requirements The appender names must already exist. Appenders are created by the %LOG4SAS_APPENDER autocall macro or defined in a logging configuration file.
When you specify more than one appender, the list must be enclosed in parentheses.
Interaction If ADDITIVITY=TRUE, log events are also passed to all of the appenders that are associated with the logger's hierarchy.
LEVEL=level
specifies the level at which log events of the specified level and higher are processed by the logger. The following are the valid level values, from lowest to highest: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
Restriction LEVEL can be modified for a logger only if the logger is defined in a logging configuration file and if the IMMUTABILITY attribute in the logger configuration file is set to FALSE. If you cannot modify a logger’s LEVEL option, contact your system administrator.

Details

Logger Names

A logger is an ancestor of another logger if the logger name, followed by a dot, is the prefix of the other logger.
In the following example, MYPROGRAM is the parent logger. MYPROGRAM is the ancestor of the UNITTEST logger, and both MYPROGRAM and UNITTEST are ancestors of the REV1 logger.
MYPROGRAM
MYPROGRAM.UNITTEST
MYPROGRAM.UNITTEST.REV1
The hierarchical organization of loggers enables them to inherit log event levels and appenders from their ancestors.

Additivity

By default, each log event is passed to the appenders that are referenced by the logger and to the appenders that are referenced by loggers in the logger's hierarchy. This is the meaning of the term appender additivity.
For example, by default, when a log event is processed by the logger MyProgram.UnitTest.Rev1, the log message is also directed to the appenders that are referenced in the MyProgram.UnitTest and MyProgram loggers. If ADDITIVITY=FALSE, the log message is directed only to the appenders that are referenced by MyProgram.UnitTest.Rev1.

Levels

A logging request is applied if its level is greater than or equal to the level of the logger. Otherwise, the logging request is ignored. Loggers without an explicitly assigned level inherit their level from the hierarchy. For more information about logging levels, see Logging Thresholds.