A logger names a specific message category and associates the message category with a message level and one or more appenders that process the log message.
See: Loggers


XML Configuration
<logger name="logger-name" additivity="TRUE | FALSE"
immutability="TRUE | FALSE">
<level value="TRACE | DEBUG | INFO | WARN | ERROR | FATAL"/>
<appender-ref ref="appender-name"/>

Syntax Description

specifies the name of a message category. The value of logger-name is case sensitive and can be a single name or a hierarchical name. Use a period to separate hierarchical names. Quotation marks are required.
Default None
Requirement Yes
additivity="TRUE | FALSE"
specifies whether to pass the log event to loggers in the hierarchy:
specifies to pass the log event to loggers in the hierarchy.
specifies not to pass the log event to loggers in the hierarchy.
Default TRUE
Requirement No
immutability="TRUE | FALSE"
specifies whether the logger’s additivity and level settings are permanent or whether they can be changed by using the SAS language. Only level and additivity changes can be made using the SAS language.
specifies that no changes can be made to the logger’s additivity and level settings..
logger level and additivity setting can be changed using the SAS language.
Default FALSE
Requirement No
Interaction IMMUTABILITY is ignored for configuration changes made by administrators using SAS Management Console or the IOMOPERATE procedure.
See %LOG4SAS_LOGGER Autocall Macro
DECLARE Statement, Logger Object
level value="TRACE | DEBUG | INFO | WARN |ERROR | FATAL"
specifies the lowest event level that is processed by this logger. Log events that have messages that are below the specified level are ignored. The valid level values are listed here from lowest to highest. If a level is not specified, SAS uses the level of the next highest parent logger that defines a level. Quotation marks are required.
Default None
Requirement No
See Logging Thresholds
appender-ref ref="appender-name"
specifies the name of an appender whose destination receives messages for log events that are specified for this logger. The value of appender-name must be defined in the XML configuration file. You can define multiple appenders for a logger.
Default None
Requirement No


The definition of an appender can appear anywhere in a logging configuration file. In a SAS program, an appender that is specified as an appender reference in a logger must be defined before the logger is defined.


Example 1: Example 1: Define a Logger to Log Error Messages for an Application in Production

This example creates a logger to record error log events for an application that is in production. The appender ApplProduction_Appender must also be defined in the XML configuration file.
<logger name="ApplProduction_Logger">
   <level value="error"/>
   <appender-ref ref="ApplProduction_Appender"/>

Example 2: Example 2: Define Loggers That Inherit the Level

In this configuration example, IOMSrv is the parent logger for IOMSrv.Workspace and IOMSrv.Metadata. The IOMSrv.Workspace logger and the IOMSrv.Metadata logger do not define a level. Therefore, they inherit the level of the closest parent, which is IOMSrv. IOMSrv defines a level of error. Log events for the IOMSrv.Workspace and the IOMSrv.Metadata message categories use the level of error and write error and fatal messages to their respective appender destinations.
<logger name="IOMSrv">
   <level value="error"/>

<logger name="IOMSrv.Workspace">
   <appender-ref ref="WorkspaceLog"/>

<logger name="IOMSrv.Metadata">
   <appender-ref ref="MetadataLog"/>