ARM Logging |
The SAS language enables you to use the SAS logging facility in a DATA step and in macro programs. Using SAS logging facility language elements, you can create appenders, loggers, and log events in your SAS programs. Loggers that you create in your SAS program can reference appenders that are created in your SAS program, or appenders that are defined in a logging configuration file. When you create a log event in your SAS program, the logger that you specify in the log event can be one that was created in your SAS program, or one that is defined in the logging configuration file. For more information, see SAS Logging: Configuration and Programming Reference.
SAS processes the logging facility language elements whether the LOGCONFIGLOC= system option specifies a logging configuration file. If the LOGCONFIGLOC= system option does not specify a logging configuration file, all SAS logging facility messages are written to the SAS log, and they are written to the SAS logging facility location specified in the log event.
The following list contains other information needed to use the SAS logging facility and the SAS language:
The logging facility is enabled for SAS programs at all times. The LOGCONFIGLOC= system option does not have to be specified for the logging facility to operate in SAS programs.
Initializing the logging facility for SAS programs is necessary only if you use the logging facility autocall macros. SAS has no initialization process for the logging facility functions and DATA step objects.
You create appenders in your SAS program before you create loggers or invoke a log event. The only appender class that you can create is FileRefAppender, which specifies to write messages to a file that is referenced by a fileref. For information about ARMAppender, see ARM Appender Overview.
You create loggers in your SAS program by using either the %LOG4SAS_LOGGER autocall macro, the LOG4SAS_LOGGER function, or the logger object DECLARE statement. Loggers must be created after you create appenders and before you invoke a log event. For information about the Perf.ARM logger, see ARM Logger Overview.
After loggers and appenders are created, you can add log events to your SAS program. You insert log events anywhere in your program or DATA step that you want to log a message. A log event takes three arguments, a logger name, a level, and the log message.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.