After an appender is defined, it can be referenced by a logger.
To reference an appender in a logging configuration file, you include
the appender name in the logger's <appender-ref> element. In
the following logger and appender definitions, the appender WinEvntVwr
is referenced by the logger WEVLogger:
<appender class="WindowsEventAppender" name="WinEvntVwr">
<param name="Appname" value="myApp"/>
</appender>
<logger name="WEVLogger">
<level="error"/>
<appender-ref ref="WinEvntVwr"/>
</logger>
To reference an appender
in a logger language element, you specify the appender name as the
value of the APPENDER-REF argument:
%log4sas_logger(myLogger, appender-ref=(myAppender), level=error);
rc= log4sas_logger("myLogger" "appender-ref=(myAppender) level=error";
declare logger logobj("myLogger");
logobj.appenderref="myAppender";
To write the same message
in multiple logs, you can specify multiple appender references in
a configuration file logger definition:
<logger name="MyLoggers">
<level="error"/>
<appender-ref ref="WinEvntVwr"/>
<appender-ref ref="RollingFileAppender"/>
</logger>
In a SAS program, you
can add multiple appender names separated by a space in the APPENDER-REF
argument:
%log4sas_logger(myLogger, appender-ref=(myAppender myRollingFile), level=error);