Previous Page | Next Page

Autocall Macro Reference

%LOG4SAS_APPENDER Autocall Macro



Defines an appender.
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 the logging facility autocall macros.
Requirement: Arguments that follow the FileRefAppender argument must be enclosed as a group in single quotation marks.

Syntax
Syntax Description
Details
Appender Names
Patterns
Thresholds
Examples
See Also

Syntax

%LOG4SAS_APPENDER(name, "FileRefAppender" <',<FILEREF=fileref>
<PATTERN="pattern"> <THRESHOLD=threshold>'>)


Syntax Description

name

specifies the name of the appender.

Tip: Appender names are case sensitive.
"FileRefAppender"

specifies the FileRefAppender class to which the defined appender belongs.

Note:   This is the only supported appender class. More appender classes might be supported in the future.  [cautionend]

Requirement: Appender classes are case sensitive. In this instance, the classname must be FileRefAppender.
Requirement: FileRefAppender must be enclosed in double quotation marks.
FILEREF=fileref

specifies the destination for log events that the FileRefAppender class processes.

PATTERN="pattern"

specifies the conversion pattern that is used to format the log message.

Requirement: The pattern must be enclosed in double quotation marks.
Tip: If PATTERN is not specified, the default is the message.
THRESHOLD=threshold

specifies the level at which log events are filtered out for the FileRefAppender. Valid values are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.


Details


Appender Names

The name argument of the appender is specified as the value in the APPENDER-REF argument in the %LOG4SAS_LOGGER autocall macro. Here is an example:

filename myfile "my.log";
%log4sas();
%log4sas_appender(myAppender,"FileRefAppender",'fileref=myfile');
%log4sas_logger(testlogger, 'level=info, appender-ref=(myAppender)');


Patterns

Patterns are a feature of SAS logging that enables you to associate a layout with a particular logging output destination. The layout specifies how the output is formatted before it is sent to the output destination. The layout is specified as a pattern string that is similar to the pattern strings that are used in the C language PRINTF statement. The pattern layout contains literal text and format directives that are called conversion specifiers.

Each conversion specifier has the following syntax:

%[format_modifiers] conversion_character

If a pattern is not specified, the default pattern contains just the application message.

For more information, see Pattern Layout.


Thresholds

An appender can be configured to have a threshold level. By default, appenders do not have a threshold set. When a threshold is set, all log events that have a level that is lower than the threshold level are ignored by the appender.

For more information, see Logging Thresholds.


Examples

The following appender definition names the appender debugMyProgram, names a log message destination using the fileref debugOutput, and specifies a pattern that reports the filename and the line number in the application that generated the log event:

filename debugOut="c:\myDebugOutput.txt";
%log4sas();
%log4sas_appender(debugMyProgram, "FileRefAppender", 
                                 'fileref=debugOut pattern="(%F:%L)%m" threshold=trace');


See Also

Autocall macros

%LOG4SAS Autocall Macro

%LOG4SAS_LOGGER 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