The SAS Logging Facility in the SAS Language |
The SAS language enables you to use the SAS logging facility in a DATA step and in macro programs. By using the SAS logging facility language elements, you can create appenders, loggers, and log events within 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 write a log event in your SAS program, the logger that you specify in the log event can be one that has been created within your SAS program or one that is configured in the logging configuration file.
SAS logging facility language elements are both functions and DATA step objects for DATA step programming. The elements are also autocall macros for macro programming.
Appenders and loggers must be defined before SAS can process a log event in your SAS program. You include log events at any point in your SAS programs where you want to log a message of any diagnostic level. The levels, from lowest to highest, are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL. Log events specify the logger, the diagnostic level, and the message.
The logging facility is enabled for SAS programs at all times. If the LOGCONFIGLOC= system option is not specified when SAS starts, all SAS logging facility messages are written to the SAS log as well as to the appender destinations that are associated with the logger that is named in a log event. When the LOGCONFIGLOC= system option is specified when SAS starts, messages are written to destinations, based on the logger hierarchy. For more information, see Hierarchical Logger Names and LOGCONFIGLOC= System Option.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.