Previous Page | Next Page

Autocall Macro Reference

%LOG4SAS_LOGGER Autocall Macro



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

Syntax
Syntax Description
Details
Logger Names
Additivity
Levels
See Also

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.

APPENDER-REF=(appender-list)

specifies one or more appender names to which log events are passed.

Requirement: The appender names must already exist. Appender names are created by the %LOG4SAS_APPENDER autocall macro.
Requirement: 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 applied by the logger. The following are the valid level values, from lowest to highest: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.


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 associated with the logger and to the appenders that are associated with the logger's hierarchy. This is the meaning of the term appender additivity.

For example, assume you have a logger, CONSOLE. The output of a log event for the logger CONSOLE goes to all of the appenders in CONSOLE and its ancestors. However, if an ancestor of logger CONSOLE, say FILE, has the additivity argument set to FALSE, then CONSOLE's output is directed to all of the appenders in CONSOLE and its ancestors up to and including FILE, but not to the appenders in any of the ancestors of FILE.


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.


See Also

Autocall macros

%LOG4SAS Autocall Macro

%LOG4SAS_APPENDER Autocall Macro

%LOG4SAS_DEBUG Autocall Macro

%LOG4SAS_TRACE Autocall Macro

%LOG4SAS_WARN Autocall Macro

%LOG4SAS_INFO Autocall Macro

%LOG4SAS_ERROR Autocall Macro

%LOG4SAS_FATAL Autocall Macro

Example of Using Autocall Macros to Log Messages

Previous Page | Next Page | Top of Page