SAS Logging
SAS Logging
SAS® Documentation
November 21, 2019
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2014. SAS® 9.4 Logging: Configuration and Programming
Reference, Second Edition. Cary, NC: SAS Institute Inc.
SAS® 9.4 Logging: Configuration and Programming Reference, Second Edition
Copyright © 2014, SAS Institute Inc., Cary, NC, USA
Overview
The logging facility has the following changes and enhancements:
n support for writing messages to z/OS operating system consoles in
ConsoleAppender
n enhanced logger security
n enhanced support for auditing logging configurations and SAS data set deletion
and renaming changes
n enhanced support for auditing SAS data sets
n The Target parameter enables you to write messages to the console’s standard
error stream instead of the standard output stream. This parameter is valid only
for Windows and UNIX environments.
Effective with the second maintenance release for SAS 9.4, the FilePermissions
parameter of FileAppender and RollingFileAppender enables you to set permissions
on log files.
n Audit.Logging.Configuration.Appender
n Audit.Logging.Configuration.Config
For more information, see “SAS Server Logger Names” on page 10.
PART 1
SAS Logging
Chapter 1
The SAS Logging Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2
Enabling the SAS Logging Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Chapter 3
System Options for Enabling the SAS Logging Facility . . . . . . . . . . . . . . . . 27
2
3
1
The SAS Logging Facility
Traditionally, the SAS log displays information, warning, and error messages as a
result of executing SAS programs or SAS global statements. Regardless of their
origin, all messages are destined for a single log.
By contrast, the SAS logging facility is a framework that categorizes and filters log
messages in SAS server and SAS programming environments, and writes log
messages to various output devices. In the server environment, the logging facility
logs messages based on predefined message categories, such as Admin for
administrative messages, App for application messages, and Perf for performance
messages. Messages for a category can be written to files, consoles, and other
system destinations simultaneously. The logging facility also enables messages to
be filtered based on the following thresholds: TRACE, DEBUG, INFO, WARN,
ERROR, and FATAL.
In the programming environment, if the logging facility is initialized for SAS server
logging, messages are written to logging facility destinations only. If the logging
facility is not initialized for SAS server logging, messages are written to the SAS log
and to logging facility destinations that are created in a SAS program.
logging configuration
an XML file or a set of SAS program statements that determines how log events
are processed. You use the logging configuration to assign thresholds to loggers,
to configure appenders, and to specify which categories and levels of log events
are to be written to each appender.
If you perform a planned deployment, then the SAS Deployment Wizard provides
default logging configuration files for your SAS servers.
message category
a classification for messages that are produced by a SAS sub-system. Message
categories for the logging facility are administrative messages, application-
specific messages, audit messages, IOM messages, and performance
messages.
pattern layout
a template that you create to format messages. The pattern layout identifies the
types of data, the order of the data, and the format of the data that is generated
in a log event. It is delivered as output.
threshold
the lowest event level that is processed. Log events whose levels are below the
threshold are ignored.
Note: You can experiment with the logging facility without creating logging
configuration files. SAS provides three basic logging configurations that write
messages to either a file, the current console, or to the traditional SAS log using the
root logger. For more information, see “LOGCONFIGLOC= System Option” on page
28.
How the Logging Facility Works 7
1 A SAS process (for example, a SAS server process) issues a log event. Each
event includes the following attributes: a name that indicates the message
category, a diagnostic level, and a message that describes the context for the
event.
2 The logging facility receives the log event and determines which logger to assign
it to, based on the event's name attribute.
3 The log event's level is compared to the threshold that is specified for the logger
in the logging configuration. If the event's level is at or above the specified
threshold, then processing continues. If the level is below the threshold, then the
event is ignored.
If no threshold is specified for the event's logger, then the event inherits the
threshold setting of the nearest ancestor logger. For example, if an
Audit.Meta.Security event is being processed, then inheritance occurs as
follows:
d If no threshold is specified for Audit, then the threshold for Root is applied.
If no thresholds are assigned to the logger or its ancestors, then the event is
ignored.
4 The log event is processed by the appenders that are assigned to the logger and
any of its ancestors in the logging configuration. For example, an
Audit.Meta.Security event is processed by the appenders that are assigned to
the following loggers: Audit.Meta.Security, Audit.Meta, Audit, and Root.
Each of these appenders processes the event according to the appender's
configuration as specified in the logging configuration. Appender processing is
performed as follows:
c The event is written to the output destination using the specifications that are
defined in the appender configuration. Appender specifications include
8 Chapter 1 / The SAS Logging Facility
Loggers
What Is a Logger?
A logger is a named entity that identifies a message category. A logger's attributes
consist of a level and one or more appenders that process the log events for the
message category. The level indicates the threshold, or lowest event level, that is
processed for this message category.
Loggers are specified in log events to associate the log event with a message
category. By categorizing log events, the logger can write messages of the same
category to the same destinations. When a log event occurs, the log event message
is processed by the appender that is associated with the logger that is named in the
event log. However, the log event level must be the same or higher than the level
that is specified for the logger.
Loggers are organized hierarchically and inherit the attributes of their ancestor
logger. Hierarchical logger names are separated by a period (.) (for example,
Admin.Meta.Security). The root logger is the highest level logger. All loggers inherit
the root logger's attributes. The logging configuration file defines several message
categories that are immediate descendants of the root logger. These high-level
categories, Admin, App, Audit, IOM, and Perf, are used for SAS server logging and
can be referenced by log events in SAS programs.
You configure loggers in a logging configuration file for SAS server logging or by
using SAS language elements in a DATA step or macro program. If you perform a
planned deployment, then the SAS Deployment Wizard provides logging
configuration files for your SAS servers. You can dynamically adjust thresholds by
using the server management features of SAS Management Console. For more
information, see “Administering Logging for SAS Servers” in the SAS Intelligence
Platform: System Administration Guide.
For more information, see “Logging Thresholds” on page 18 and “Appenders” on
page 12.
Syntax Description:
Loggers 9
name="logger-name"
specifies the name of a message category name. The logger name is specified
in a log event to associate a message with a message category.
additivity= |
specifies whether to pass the log event to loggers in the hierarchy.
immutability= |
specifies whether the logger’s additivity and level settings are permanent or
whether they can be changed by using the SAS language. In addition, specifies
whether an appender can be attached to a logger by using the SAS language. If
the value of IMMUTABILITY is TRUE, no changes can be made to the logger’s
additivity and level settings and an appender cannot be attached to a logger by
using the SAS language. If the value of IMMUTABILITY is FALSE, the logger
level and the additivity setting can be changed using the SAS language and
appenders can be attached to loggers by using the SAS language.
IMMUTABILITY is ignored for configuration changes that were made by
administrators using SAS Management Console or the IOMOPERATE
procedure.
level value="threshold"
specifies one of the following levels, from lowest to highest: TRACE, DEBUG,
INFO, WARN, ERROR, FATAL. You use the threshold to filter log events. If the
log event diagnostic level is the same or higher than the threshold that is
specified for the log event's logger, the logging facility continues to process the
log event. If the log event diagnostic level is lower than the logger's threshold,
the log event is ignored.
appender-ref ref="appender-name"
specifies the name of an appender to record messages for this logger's message
category.
<logger name="Admin.MyPgm">
10 Chapter 1 / The SAS Logging Facility
<level value="Debug"/>
</logger>
<root>
<level value="Error"/>
<appender-ref ref="SystemRollingFile">
</root>
If a log event specifies a hierarchical logger name that does not exist, the logging
facility checks for a parent logger definition. If the parent logger exists, the log event
is processed by the parent logger. If a logger definition does not exist for the parent,
the root logger processes the log event.
Consider the example logger definitions in this section. If a log event specifies the
logger Admin.Special, the logging facility determines that the logger Admin.Special
does not exist. The logging facility then checks for the Admin logger. In this case,
the Admin logger exists and the log event is processed by the Admin logger. If the
Admin logger was not defined, the root logger would process the log event.
are self-explanatory. The following list gives some examples of server categories for
the logging facility.
Here is a list of some of the loggers that the logging facility uses for SAS servers:
Admin.Operations
processes log events that are related to server operations, such as starting,
pausing, and stopping an instance of a workspace server.
Admin.Session
processes log events that are related to starting and stopping batch, windowing,
and SAS/CONNECT server sessions.
Audit.Authentication
processes log events for server authentication requests.
Audit.Data.Dataset.Open
processes log events that are related to users’ access to SAS libraries.
Audit.Logging.Configuration.Logger
processes log events that are related to configuring a logger.
Audit.Logging.Configuration.Appender
processes log events that are related to configuring an appender.
Audit.Logging.Configuration.Config
processes log events for all logging configuration changes.
App.Program
processes log events that are related to running a program using the SAS
language.
IOM
processes log events that are related to client interactions.
IOM.PE
processes log events that are related to packets that are processed by the
BRIDGE and COM protocol engines.
Perf.ARM
processes log events that are related to ARM 4.0 transactions.
SAS issues an error message if a logger cannot be configured or accessed.
See the following reference documents for information about defining loggers in the
SAS language:
n “%LOG4SAS_LOGGER Autocall Macro” on page 168
If you are writing SAS programs, you can write log events for loggers that are
defined in one of the logging configuration files, or you can write log events for
loggers that you create by using the SAS language.
Loggers that are created by using the SAS language exist for the duration of the
SAS session.
Appenders
Appender Overview
An appender is a named entity that is referenced by a logger. An appender specifies
the destination for the message, specifies how the message is formatted, specifies
attributes for the appender class, and provides additional filtering capabilities.
When a log event occurs, the logging facility processes the message by using the
appender that is named. The appender can be named either in the logger's
<appender-ref> element in a logging facility configuration file, or in the APPENDER-
REF argument of a logger language element in a SAS program.
SAS has several appender classes for processing messages:
n appenders to log messages to an operating system console
For a complete list and description of the SAS server appenders, see “SAS
Appenders for Server Logging” on page 16.
You define appenders in the logging configuration file or in a SAS program by using
a SAS function, autocall macro, or DATA step component object. An appender
definition requires an appender class and name and the required parameters for the
appender class. To customize the message, you specify the message layout within
the appender definition. In a logging facility configuration file, you can include
additional filtering arguments in the appender definition.
Logger definitions in SAS programs can reference appenders that are defined in a
SAS program or any of the SAS server appenders. Appenders that you create by
Appenders 13
using the SAS language can be attached to a logger only if the logger immutability
is not set.
For more information, see “Creating and Using Appenders in a SAS Program ” on
page 151.
n ConsoleAppender
n DBAppender
n FileAppender
n FilteringAppender
n IOMServerAppender
n JavaAppender
n JMSAppender
n RollingFileAppender
n sLogAppender
n UNXFacilityAppender
n WindowsEventAppender
n ZOSFacilityAppender
n ZOSWtoAppender
name="appender-name"
The appender name is a user-specified name for the appender. An appender is
associated with a logger when the appender name is specified as the value of
the logger's appender-ref attribute.
<param name="parameter-name" value="parameter-value"/>
Most appenders have required parameters for specifying information that is
relevant to the appender. Many parameter names are unique for individual
appenders. The name= attribute specifies the name of the parameter, and the
value= attribute specifies the value for the parameter.
For example, appenders that write messages to a user-specified file use the File
parameter, where the value of the File parameter specifies the location and
name of the log file.
Note: The following layout syntax is valid only for SAS 9.4 environments.
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
<param name="Header" value="literal-string"/>
<param name="HeaderPattern" value="conversion-pattern"/>
<param name="Footer " value="literal-string"/>
<param name="FooterPattern" value="conversion-pattern"/>
<param name="XMLEscape" |
</layout>
You use the <layout> elements to specify how messages should be formatted in
the log. The conversion pattern is a series of conversion characters that
represent the types of data to include in the log. For example, use the
conversion characters %d, %t, and %m to include the date and time, the thread
identifier, and the message, respectively, in the log.
You can use the Header, HeaderPattern, Footer, and FooterPattern parameters
to specify the conversion characters that appear at the top and the bottom of the
log. You can use the XMLEscape parameter to specify whether certain
characters (for example, "<") are converted to their entity representation, which
in this case would be "<".
Note: The following layout syntax is valid only if you have SAS 9.4 and SAS Viya in
your environment.
<layout type= |
<param name= |
<layout-parameters>
</layout>
You use the <layout> elements to specify how messages should be formatted in
the log. If the layout type is “standard”, then the conversion pattern is used to
configure the output as it is configured in an environment that is running SAS 9.4
only. If the layout type is “json”, then JSON options that are included in the
ensuing layout parameters are used to configure the output into a JSON object.
All of the ensuing layout parameters except for the Individual parameter are
considered to be JSON options.
Appenders 15
n Individual parameter
{"key": "value"...}
{"key": "value"...}
{"key": "value"...}
{"key": "value"...}
n JSON type
The type of the parameter value can be specified by adding one of the
following strings to the end of the parameter name. If one of these set strings
is present, then the logging facility tries to format the value into that type. The
supported types and their associated strings are as follows:
Numeric #
List []
Boolean ^
Object {}
The JSON layout type is used by the RabbitmqAppender for internal log
processing.
<filter>
<filter-definitions>
</filter>
You can use filters to accept or deny messages based on the following:
n a character string in the message
WindowsEventAppender
writes messages to the Windows Event log.
ZOSFacilityAppender
enables multiple instances of SAS in the z/OS operating system to write
messages to a common location.
ZOSWtoAppender
directs SAS application messages to the z/OS operating system console.
<logger name="WEVLogger">
<level="error"/>
<appender-ref ref="WinEvntVwr"/>
</logger>
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");
Logging Thresholds
The SAS logging facility provides six thresholds: TRACE, DEBUG, INFO, WARN,
ERROR, and FATAL. Thresholds are used to ignore log events that are lower than a
particular level, or to filter messages so that only a single message level is logged.
When a log event occurs, up to three levels of filtering can take place:
1 filtering log events by comparing the log event level to the log event's logger
level
2 filtering log events by comparing the log event level to the appender's threshold
3 filtering log events by comparing the log event level to the threshold that is
specified in the filter definition, which is a part of the appender configuration
In the first two cases, if the log event level is lower than the logger or appender
threshold, the logging facility ignores the log event. Otherwise, processing of the log
event continues.
In the third case, the log event level is compared to the filter threshold. If there is a
match, the log event can be either accepted or denied. If there is no match, the
filtering process continues to the next filter in the filtering policy. For more
information, see “Filters” on page 135.
The logging levels, from the lowest to the highest, are as follows:
TRACE
produces the most detailed information about your application. This level is
primarily used by SAS Technical Support or development.
DEBUG
produces detailed information that you use to debug your application. This level
is primarily used by SAS Technical Support or development.
INFO
provides information that highlights the progress of an application.
WARN
provides messages that identify potentially harmful situations.
ERROR
provides messages that indicate that errors have occurred. The application might
continue to run.
Formatting Messages 19
FATAL
provides messages that indicate that severe errors have occurred. These errors
will probably cause the application to end.
Requirement: In a logging configuration file, the level must be enclosed in quotation
marks.
An appender can be configured to have a threshold. By default, however,
appenders do not have a threshold. When set, all log events that have a level lower
than the threshold are ignored by the appender.
Formatting Messages
The format of a message can be customized by specifying a unique pattern layout
for each appender class in the SAS logging facility. To create a pattern layout for an
appender class, you use conversion characters that represent the types of data to
include in the message. You can also control the sequence of the data and the
alignment of the data in columns in the message.
Note: Conversion patterns that are used in the SAS logging facility are similar to
the conversion patterns that are used in the C language PRINTF statement.
Note: The ARMAppender classes use a set of pattern layouts that are only for the
ARM subsystem. For more information, see “ARM Appender Pattern Layouts for
ARM Messages” in SAS Interface to Application Response Measurement (ARM):
Reference.
Message Filtering
In addition to filtering log events based on thresholds that are assigned to loggers or
appender definitions, the logging facility enables you to use filter classes to filter log
events based on the following:
n a character string in the message
n a single threshold
n a range of thresholds
You can also use the Loggers tab in SAS Management Console to dynamically
adjust server logging levels, without the need to restart the server. The following
example shows the Loggers tab for the metadata server:
For more information, see “Using SAS Management Console to Monitor SAS
Servers” in the SAS Intelligence Platform: System Administration Guide.
n SAS Data Integration Studio. From this application, you can view performance-
related events that are associated with a SAS Data Integration Studio job. For
more information, see the product Help.
You can also use enterprise systems management products to view server logging
messages and dynamically adjust server logging levels. For more information, see
the Enterprise Management Integration web page at http://support.sas.com/rnd/emi.
n Do not use the TRACE and DEBUG levels unless you are directed to do so by
SAS Technical Support, since these logging levels can affect performance. You
can use either of these methods to adjust logging levels for SAS Technical
Support:
o Enable the logconfig_trace.xml file that is provided for the server.
o Use the server manager features of SAS Management Console to adjust
levels temporarily and avoid having to restart the servers.
For more information, see the following documents:
n “Administering Logging for SAS Servers” in the SAS Intelligence Platform:
System Administration Guide on http://support.sas.com.
n SAS Interface to Application Response Measurement (ARM): Reference
describes SAS features that are compliant with the ARM 2.0 and ARM 4.0
standards and that enable you to monitor the performance of SAS applications.
24 Chapter 1 / The SAS Logging Facility
25
2
Enabling the SAS Logging Facility
3
System Options for Enabling the
SAS Logging Facility
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
LOGAPPLNAME= System Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
LOGCONFIGLOC= System Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Dictionary
Note: This option cannot be restricted by a site administrator. For more information, see
“Restricted Options” in SAS System Options: Reference.
Syntax
LOGAPPLNAME=name
Syntax Description
name
specifies a name for the SAS session. If the name contains a space, enclose the
name in either single or double quotation marks.
Details
The name that is specified by the LOGAPPLNAME= system option is used to
identify the name of a SAS session in logging facility logs if the S conversion
character is specified in the pattern layout.
28 Chapter 3 / System Options for Enabling the SAS Logging Facility
You can use the &SYSLOGAPPLNAME automatic macro variable to obtain the
name of the SAS session in a SAS program.
See Also
n “S Conversion Character” on page 128
Alias: LOGCFGLOC=
Note: This option can be restricted by a site administrator. For more information, see
“Restricted Options” in SAS System Options: Reference.
Syntax
Production Syntax
LOGCONFIGLOC=file-specification
Basic Logging Configuration Syntax
LOGCONFIGLOC=basic:level, FileAppender, path-and-filename-pattern
LOGCONFIGLOC=basic:level, ConsoleAppender
LOGCONFIGLOC=basic:level
Syntax Description
file-specification
specifies the physical name of the XML configuration file that is used to initialize
the SAS logging facility. The physical name is the name that is recognized by
your operating system. Enclose the physical name in single or double quotation
marks if the name contains spaces.
basic:level,FileAppender, path-and-filename-pattern
specifies to write messages to the specified file. basic: indicates to use the root
logger. FileAppender indicates to use the FileAppender class.
Provide values for these arguments:
LOGCONFIGLOC= System Option 29
level
specifies the logging threshold. Valid values are TRACE, DEBUG, INFO,
WARN, ERROR, or FATAL.
path-and-filename-pattern
specifies the path to which the log file is written and the conversion pattern
that is used to create the log filename. The conversion pattern can include
the %d and %S{key} conversion characters.
basic:level,ConsoleAppender
specifies to write messages to the current console. basic: indicates the root
logger. ConsoleAppender indicates to use the ConsoleAppender class.
Provide a value for this argument:
level
specifies the logging threshold. Valid values are TRACE, DEBUG, INFO,
WARN, ERROR, or FATAL.
Note This configuration uses the conversion pattern DEFAULTHEADER for the
HeaderPattern parameter and the conversion pattern DEFAULT for the
ConversionPattern parameter.
basic:level
specifies to use the root logger. When the root logger is specified without an
appender, messages are written to the traditional SAS log.
Provide a value for this argument:
level
specifies the logging threshold. Valid values are TRACE, DEBUG, INFO,
WARN, ERROR, or FATAL.
Details
The Basics
If the LOGCONFIGLOC= system option is specified when SAS starts, and if the
SYSIN= option or the OBJECTSERVER option is also specified, logging is
performed only by the logging facility; the SAS log is not started and the
LOGPARM= system option is ignored. The LOG= system option is applied only
when the %S{App.Log} conversion character is specified in the logging
configuration file.
n basic:level,ConsoleAppender
n basic:level
By using one of the basic logging configurations, you can experiment with the
logging facility without creating a configuration file. SAS creates a configuration file
for you based on the basic logging configuration that you specify in the
LOGCONFIGLOC= system option. The basic logging configurations enable
messages to be written to a file, the current console, and the traditional SAS log.
Example
The following example shows the use of the LOGCONFIGLOC= system option for a
user-specified logging configuration:
sas -logconfigloc metaserverlog.xml
The following example shows the use of the LOGCONFIGLOC= system option for a
basic logging configuration:
sas -logconfigloc basic:INFO,FileAppender,c:\mylog\logFacility.%S{hostname}.log
31
PART 2
Chapter 4
Overview of the Logging Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter 5
Logger Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Chapter 6
Appender Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Chapter 7
Database Connection Options Reference for DBAppender . . . . . . . . . . . . . 99
Chapter 8
Pattern Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Chapter 9
Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
32
33
4
Overview of the Logging
Configuration File
Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
XML Elements for Configuring SAS Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Structure of the Logging Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Sample Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Modifying or Replacing the Logging Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . 39
Error Messages for Logging Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Typographical Conventions
Type styles have special meaning for some components of XML syntax in the
logging configuration file. The following list explains the style conventions for the
syntax:
italics
identifies arguments or values that you supply. Items in italics can represent
user-supplied values that are either one of the following:
n nonliteral values that are assigned to an argument (for example,
value="column-parameter")
n nonliteral arguments (for example, <filter-definitions>)
case sensitivity
All text is case sensitive in the logging configuration file. Enter element and
attribute names, as well as literal values, as they are shown in the syntax.
34 Chapter 4 / Overview of the Logging Configuration File
Syntax Conventions
In traditional SAS syntax, angle brackets (<>) are used to denote optional syntax. In
the logging configuration file syntax, square brackets ([ ]) are used to denote
optional syntax. The logging configuration file syntax uses the following symbols:
<>
The left angle bracket begins an XML element. The right angle bracket ends an
XML element.
/
A slash before an element name ends the element definition.
/>
A slash followed by a right angle bracket ends the definition for the <param>,
<level>, and <appender-ref> subelements.
[]
Square brackets identify optional elements or arguments. Any XML element or
attribute that is not enclosed in square brackets is required.
|
A vertical bar indicates that you can choose one value from a group of values.
Values separated by bars are mutually exclusive.
-1-n…
For repeated elements, the -1 after an element indicates the first element. The
ellipsis before an element and the -n after the same element indicate that the
element can be repeated any number of times.
""
Double quotation marks identify an attribute value.
a fixed SAS logger and Note: A root logger is not required for a logging configuration file that
the highest logger in is used to modify a logging configuration.
any logging hierarchy
n Attributes: none
</root>
n optional child elements: number of instances
2 <logging:configuration>
After the <logging: configuration> element, these elements can appear in any order:
n <appender>
38 Chapter 4 / Overview of the Logging Configuration File
n <logger>
n <root>
See “XML Elements for Configuring SAS Logging” on page 34 for information about
the number of instances for each element.
Here is an example configuration file that shows the structure of the configuration
file:
<?xml version="1.0" encoding="UTF-8"?>
<logging:configuration xmlns:logging="http//support.sas.com/xml/logging/1.0/">
<appender class="RollingFileAppender" name="TimeBasedRollingFile">
<param name="Append" value="true"/>
<param name="ImmediateFlush" value="true"/>
<param name="Unique" value="true"/>
<filter class="StringMatchFilter">
<param name="LevelToMatch" value="error"/>
<param name="AcceptOnMatch" value="true"/>
</filter >
<rollingPolicy class="TimeBasedRollingPolicy">
<param name="FileNamePattern" value="c:\sas\logs\server\workspace_%d.log"/>
</rollingPolicy>
<layout>
<param name="ConversionPattern" value="%d %-5p [%t] %u - %m"/>
</layout>
</appender>
<appender class="FileAppender" name="rootAppender">
<param name="Append" value="true"/>
<param name="ImmediateFlush" value="true"/>
<param name="File" value="c:\logs\root\root1.log"/>
</appender>
<logger name="log4WServer">
<level value="info"/>
<appender-ref ref="TimeBasedRollingFile"/>
</logger>
<root>
<level value="error">
<appender-ref ref="rootAppender"/>
</root>
</logging:configuration>
1 logconfig.xml.win.admin.event.viewer
2 logconfig.xml.win.audit.event.viewer
3 logconfig.xml.win.audit.file
Modifying or Replacing the Logging Configuration File 39
4 logconfig.xml.win.loggers.rollingfile
5 logconfig.xml.win.perf.file
6 logconfig.xml.win.root.dba
1 logconfig.xml.unx.admin.syslog
2 logconfig.xml.unx.audit.syslog
3 logconfig.xml.unx.audit.file
4 logconfig.xml.unx.loggers.rollingfile
5 logconfig.xml.unx.perf.file
6 logconfig.xml.unx.root.dba
n remove an appender
To modify the logging configuration, you create a logging configuration file only with
the changes that you would like to make. A complete configuration file is not
required. The configuration file must contain the <?xml>, <logging:configuration>,
and </logging:configuration> elements. Any time you modify the logging
configuration, the <logging:configuration> element must have the modify attribute
set to "TRUE". If you are removing an appender, the remove attribute on the
appender element must be set to "TRUE". Here is an example of a logging
configuration file that is used to associate an existing appender with a logger:
<?xml version="1.0"?>
<logging:configuration
xmlns:logging="http://www.sas.com/xml/logging/1.0/" modify="true">
<logger name="App.Program">
<appender-ref ref="newcons"/>
40 Chapter 4 / Overview of the Logging Configuration File
</logger>
</logging:configuration>
To replace the logging configuration, you create a new logging configuration file.
The <logging:configuration> element must have the modify attribute set to "FALSE"
or the modify attribute must not be present in the <logging:configuration> element.
When you modify or replace the logging configuration, the IOMOPERATE procedure
might look similar to this:
proc iomoperate uri="iom://localhost:15976;Bridge;TRUSTEDSAS" type=METADATA;
set log cfg="newcfg.xml";
quit;
5
Logger Reference
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Logger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Dictionary
Logger
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” on page 8
Syntax
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"/>
</logger>
Syntax Description
name="logger-name"
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= |
specifies whether to pass the log event to loggers in the hierarchy:
42 Chapter 5 / Logger Reference
TRUE
specifies to pass the log event to loggers in the hierarchy.
FALSE
specifies not to pass the log event to loggers in the hierarchy.
Default TRUE
Requirement No
immutability= |
specifies whether the logger’s additivity and level settings are permanent or
whether they can be changed by using the SAS language. In addition, specifies
whether an appender can be attached to a logger using the SAS language.
These are the only changes that can be made using the SAS language.
TRUE
specifies that no changes can be made to the logger’s additivity and level
settings and that an appender cannot be attached to a logger using the SAS
language.
FALSE
logger level and additivity setting can be changed using the SAS language
and an appender can be attached to a logger using the SAS language.
Default FALSE
Requirement No
level value= | | | | |
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
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
Example 2: Define Loggers That Inherit the Level 43
Requirement No
Details
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.
Examples:
<logger name="IOMSrv.Workspace">
<appender-ref ref="WorkspaceLog"/>
</logger>
<logger name="IOMSrv.Metadata">
<appender-ref ref="MetadataLog"/>
</logger>
44 Chapter 5 / Logger Reference
45
6
Appender Reference
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ARMAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ConsoleAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
DBAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
FileAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
FilteringAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
IOMServerAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
JavaAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
JMSAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
RabbitmqAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
RollingFileAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
sLogAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
UNXFacilityAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
WindowsEventAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
ZOSFacilityAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
ZOSWtoAppender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Dictionary
ARMAppender
Logs performance data based on ARM 2.0 and ARM 4.0 standards. It supports default transaction
correlation and converts ARM transaction events that were created prior to SAS 9.2 into SAS log events.
Valid in: XML Configuration
Note: ARMAppender syntax is case sensitive.
See: This document covers only the syntax of ARMAppender. For information about using
ARM in SAS, including details about using ARMAppender, see SAS Interface to
Application Response Measurement (ARM): Reference
Syntax
<appender class="FileAppender" name="ARM-log-name">
<param name="File" value="file-name"/>
<layout>
46 Chapter 6 / Appender Reference
<param name="ConversionPattern"
value="%d,
%X{App.Name},
%X{ARM.Id},
%X{ARM.GroupName},
%X{ARM.TranName},
%X{ARM.TranState},
%X{ARM.TranId},
%X{ARM.TranHandle},
%X{ARM.ParentCorrelator},
%X{ARM.CurrentCorrelator},
%X{ARM.TranStatus},
%X{ARM.TranStart.Time},
%X{ARM.TranStop.Time},
%X{ARM.TranBlocked.Time},
%X{ARM.TranResp.Time}
"/>
</layout>
</appender>
<appender class="ARMAppender" name="ARM-appender-name">
<param name="Agent" value="ARM-agent-library"/>
<param name="Encoding" value="encoding-value"/>
<param name="GetTimes" value="TRUE | FALSE"/>
<param name="ManageCorrelators" value= "TRUE | FALSE"/>
<param name="AppName" value="application-name"/>
<param name="GroupName" value="group-name"/>
<appender-ref ref="ARM-log-names"/>
</appender>
Syntax Description
appender class="ARMAppender" name="ARM-appender-name"
specifies an appender name for the ARM appender.
Default None
name="Agent" value="ARM-agent-library"
specifies the name of the library that contains the external ARM 4.0 agent library
that receives the events, in addition to the referenced appenders. See your
vendor documentation for the correct library name. Two values can be used:
value=" "
if no agent is specified, output is sent to any referenced appenders. In the
syntax example, the output is sent to the file appender, "ARM-log-name".
Note If you intend to have a null value for the Agent parameter, you do not
need to specify the parameter.
value="library-name"
specifies the name of the library that contains the external ARM 4.0 agent
library that receives the events.
ARMAppender 47
name="AppName" value="application-name"
specifies the name of the application. The maximum length of the value is 128
characters, which includes the termination character ( / ). This value is sent to
the ARM_REGISTER_APPLICATION() function call. To override this value,
specify the SAS start-up option LOGAPPLNAME=application-name.
Default SAS
name="ConversionPattern" value="conversion-pattern"
specifies how the log event is written to the ARM log.
Default None. If a conversion pattern is not specified, then the log event
produces an empty string.
name="Encoding" value="encoding-value"
specifies the type of character set encoding that is used for strings that are sent
to and calls that are received by the ARM 4.0 agent library.
Default Native Unicode character is set for the host, or UTF-8 as required by the
ARM 4.0 standards.
name="File" value="path-and-filename"
specifies the path and filename of the file to which ARM messages are written.
Default None
name="GetTimes" |
enables the ARM appender to compute transaction response time metrics.
TRUE
enables the appender to compute transaction response times.
FALSE
disables the appender to compute transaction response times.
Default FALSE
name="ManageCorrelators" |
specifies whether ARMAppender manages transaction correlation.
TRUE
enables automatic transaction correlation. The true value might affect existing
benchmarks for ARM 2.0 records.
48 Chapter 6 / Appender Reference
FALSE
enables the application to manage transaction correlation.
Default TRUE
name="GroupName" value="group-name"
specifies the name of a group of application instances, if any. Application
instances that are started with a common run-time purpose are candidates for
using the same group name. The maximum length of the value is 256
characters. This value is passed to the ARM_START_APPLICATION() function
call.
Details
ARMAppender is configured and customized for accessing performance data. The
primary role of ARMAppender is to record ARM transaction events, process the
events, and route the events to an appropriate output destination. These events,
when processed by ARMAppender, are formatted in the appropriate ARM 4.0
format, using the fixed portion of the message and the values that were recorded in
the diagnostic context.
The existing ARM 2.0 implementations are changed to logger requests that contain
the appropriate performance event attribute settings.
For more information about ARM and ARMAppender, see SAS Interface to
Application Response Measurement (ARM): Reference.
Example
The following example is a SAS logging facility configuration file that includes
ARMAppender. In the appender FileAppender class definition, the conversion
pattern is separated by the vertical bar (|). The log message contains any character
that you enter between conversion patterns.
<?xml version="1.0" encoding="UTF-8"?>
<logging:configuration xmlns:logging="http://www.sas.com/xml/logging/1.0/">
%8X{ARM.TranState}|%8X{ARM.TranStatus}|%20X{ARM.TranStart.Time}|
%20X{ARM.TranStop.Time}|%56X{ARM.ParentCorrelator}|
%56X{ARM.CurrentCorrelator}"/>
</layout>
</appender>
<root>
<level value="info"/>
<appender-ref ref="LOG"/>
</root>
</logging:configuration>
ConsoleAppender
Writes messages to the UNIX, Windows, and z/OS operating system consoles.
Valid in: XML configuration
Syntax
<appender class="ConsoleAppender" name="appender-name">
<param name="ImmediateFlush" value="TRUE | FALSE"/>
<param name="Target" value="STDOUT | STDERR"/>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
</appender>
50 Chapter 6 / Appender Reference
Syntax Description
<class="ConsoleAppender" name="appender-name">
specifies the user-assigned name for this instance of ConsoleAppender.
Default None
Requirement The appender class and name are required in order to specify a
console appender.
name="ImmediateFlush" |
determines whether messages are written to the console immediately as they
are received. Specify one of the following values:
TRUE
writes messages to the console immediately as they are received.
FALSE
does not force messages to be written to the console immediately as they are
received.
Default FALSE
name="Target" |
specifies the console output stream to which messages are to be written. Specify
one of the following values:
STDOUT
writes messages to the console’s standard output stream.
STDERR
writes messages to the console’s standard error stream.
Default STDOUT
Details
ConsoleAppender is a logging facility appender that supports event logging on
UNIX, Windows, and z/OS operating systems. ConsoleAppender writes messages
to the current console.
Example
The following example is a typical XML configuration file that specifies
ConsoleAppender.
DBAppender 51
DBAppender
Writes log events to a SAS table or to a table in a third-party DBMS.
Valid in: XML Configuration
Syntax
Syntax Description
class="DBAppender" name="appender-name"
specifies the user-assigned name for this instance of DBAppender.
Default None
name="ConnectionString" value="connection-string"
specifies options for connecting to the data store to which events are to be
written. Within the connection string, place a semicolon between each option.
The options vary depending on the type of data store you are using. For details,
see:
n “DBAppender Connection Options for DB2” on page 99
name="Locale" value="locale"
specifies the locale that is used to write messages to the file.
Defaults The locale setting that is in effect for the SAS session. For
example, the LOCALE system option might be specified in the
configuration file for a SAS server or in the configuration file for
Base SAS.
name="MaxBufferedEvents" value="integer"
specifies the maximum number of log events to buffer before sending them to
the data store. When MaxBufferedEvents is set to 0, messages are processed
synchronously, one row at a time.
Default 1
name="SelectStatement" value="SQL-statement"
specifies an SQL statement that identifies the name of the table, and the names
of specific columns within the table, where event information is to be written. The
table must already exist. If you want to write information to all of the columns in
the table, use TableName instead of SelectStatement.
name="TableName" value="table-name"
specifies the name of the table to which event information is to be written. The
table must already exist. If you want to write to just a subset of the columns in
the table, use SelectStatement instead of TableName.
Details
Before using DBAppender, you must first create the table to which the log events
are to be written. The Column parameters must be specified in exactly the same
order that the corresponding columns occur in the table.
DBAppender processes only a subset of loggers and ignores events for all other
loggers. For each ignored event, a new event is created that contains the original
event and a message stating that the event was ignored. These new events, which
are written to the Logging.Appender.DB logger at the DEBUG level, can be routed
to another appender for capture.
DBAppender processes the following subset of loggers:
54 Chapter 6 / Appender Reference
n Perf.ARM.application-name.APPL
n Perf.ARM.application-name.DSIO
n Perf.ARM.application-name.PROC
n Perf.ARM.OLAP_SERVER
For the Perf.ARM loggers, you can use any of the following methods to specify
application-name:
n specify the LOGAPPLNAME= system option on the command line. See
“LOGAPPLNAME= System Option” on page 27.
n specify the AppName parameter in the configuration for the ARMAppender. See
“ARMAppender” on page 45.
n specify the value when coding one of the Application Response Measurement
(ARM) macros. See the SAS Interface to Application Response Measurement
(ARM): Reference.
If you do not specify a value for application-name, the default value SAS is used.
Examples:
FileAppender
Writes messages to the specified file in the specified path.
Valid in: XML configuration
Syntax
<appender class="FileAppender" name="appender-name">
<param name="Append" value="TRUE | FALSE"/>
<param name="Encoding" value="encoding-value"/>
<param name="File" value="path-and-filename"/>
<param name="FileNamePattern" value="path-and-filename-pattern"/>
<param name="FilePermissions" value="permission-value-1,permission-
value-2..."/>
<param name="ImmediateFlush" value="TRUE | FALSE"/>
<param name="Locale" value="locale"/>
<param name="Threshold" value="TRACE | DEBUG | INFO | WARN | ERROR |
FATAL"/>
<param name="Unique" value="TRUE | FALSE"/>
<filter>
<filter-definitions>
</filter>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
</appender>
Syntax Description
class="FileAppender" name="appender-name"
specifies the user-assigned name for this instance of FileAppender.
Default None
58 Chapter 6 / Appender Reference
name="Append" |
controls how messages are written to the log file if the file already exists when
logging begins. Specify one of the following values:
TRUE
appends new messages to the end of the existing file.
FALSE
erases the contents of the existing file and overwrites them with new
messages.
Default TRUE
Interaction If both the Unique parameter and the Append parameter are
specified, then the Unique parameter takes precedence. For
details, see name=" Unique" on page 60.
name="Encoding" value="encoding-value"
specifies the encoding that is used to write messages to the file.
Defaults The encoding setting that is in effect for the SAS session. For
example, the ENCODING system option might be specified in the
configuration file for a SAS server or for Base SAS. If the
ENCODING system option is not specified for the SAS session,
then the defaults that are described in the SAS National Language
Support (NLS): Reference Guide
name="File" value="path-and-filename"
specifies the path and filename of the file to which messages are written.
Default None
Interaction If both the File parameter and the FileNamePattern parameter are
specified, then the File parameter takes precedence.
name="FileNamePattern" value="path-and-filename-pattern"
specifies the path to which the log file is written and the conversion pattern that
is used to create the log filename. The conversion pattern can include the
following characters:
%d
indicates where the current date appears. You can specify a date format or a
date and time pattern in braces after %d if you want the date to appear in a
FileAppender 59
%S{key}
indicates where system information (such as the host name, operating
system, system description, or process ID) appears. You must specify a key
to indicate the type of system information that appears.
For example, suppose you want the log files to be written to the path c:\logs\,
and you want the filename to include the current date and the name of the
metadata server host machine. Specify c:\logs\MetadataServer_%d_
%S{host_name}.log.
Default None
Interaction If both the File parameter and the FileNamePattern parameter are
specified, then the File parameter takes precedence.
name="FilePermissions" value="permission-value-1,permission-value-2..."
specifies one or more sets of permissions to set for the log file. To specify more
than one set, separate them with a comma within the quotation marks. Use the
following syntax for each permission value:
A::<trustee_type>::<permissions>
A
indicates that these are access permissions. No other values are supported.
trustee_type
indicates which users the permissions apply to. The following values are
supported:
u the user whose credentials are being used to generate the log file.
o all other users. On UNIX systems, this value includes all users except
those specified by u and g. On Windows systems, this value includes
all users including those specified by u and g.
permissions
the permission string that applies to the trustee type. The permission string
takes the values r (Read), w (Write), and x (Execute), in that order. If you do
not want to grant one of these permissions, enter a hyphen (-) in its place.
For example, specify r‑x or rw‑.
Note: The specified file permissions take effect only when a new file is being
created or when the current user is the owner of the existing file.
Default If this parameter is not specified, the logging facility does not apply any
permissions other than those that are applied by the operating system.
60 Chapter 6 / Appender Reference
See For additional details and examples, see the PERMISSION argument in
the following documentation topics: “FILE Statement: Windows” in SAS
Companion for Windows and “FILE Statement: UNIX” in SAS Companion
for UNIX Environments.
Example The following parameter sets permissions that enable only the owning
user to write to the log file. All other users can only read the file.
<param name="FilePermissions" value="A::u::rw-,A::g::r--,A::o::r--"/>
name="ImmediateFlush" |
determines whether messages are written to the file immediately or held in a
buffer. Specify one of the following values:
TRUE
writes messages to the file immediately as they are received.
FALSE
holds messages in a buffer and writes them to the file when the buffer is full.
The buffer size is 16 KB.
Default FALSE
name="Locale" value="locale"
specifies the locale that is used to write messages to the file.
Defaults The locale setting that is in effect for the SAS session. For
example, the LOCALE system option might be specified in the
configuration file for a SAS server or in the configuration file for
Base SAS.
name="Threshold" | | | | |
specifies the lowest event level that this appender processes. Events that are
below the specified level are ignored. The valid values are listed here from
lowest to highest.
Default None
Requirement No
name="Unique" |
creates a new file, with an underscore and a unique number appended to the
filename, if the log file already exists when logging begins. Numbers are
assigned sequentially from 0 to 32766.
FileAppender 61
Default FALSE
Interactions If both the Unique parameter and the Append parameter are
specified, then the Unique parameter takes precedence. If the log
file already exists when logging begins, messages are logged as
follows:
filter-definitions
specifies the names and associated parameters of filters that limit the messages
that are logged by this appender.
Default None
Requirement No
name="ConversionPattern" value="conversion-pattern"
specifies how the log message is written to the log.
Default None. If a conversion pattern is not specified, then the log event
produces an empty string.
Requirement No
Details
FileAppender writes messages to the specified file in the specified path. When you
create an instance of FileAppender, you can specify the following:
n how messages are written if the file already exists when logging begins.
Messages can be appended to the end of the existing file, they can overwrite the
existing file contents, or they can be written to a new file that has a unique name.
n whether to write messages immediately upon receipt or to hold them in a buffer.
FilteringAppender
Filters events based on thresholds and string values to determine whether the events should be passed to
a referenced appender. You can specify a layout to be applied to the events before they are passed.
Valid in: XML configuration
Syntax
<appender class="FilteringAppender" name="appender-name">
<appender-ref ref="referenced-appender-name"/>
<filter>
<filter-definitions>
</filter>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
<param name="Locale" value="locale"/>
<param name="PropagateLayout value="TRUE | FALSE"/>
<param name="Threshold" value="TRACE | DEBUG | INFO | WARN | ERROR |
FATAL"/>
</appender>
Syntax Description
class="FilteringAppender" name="appender-name"
specifies the user-assigned name for this instance of FilteringAppender.
FilteringAppender 63
Default None
ref="referenced-appender-name"
specifies the appender that events are to be passed to.
filter-definitions
specifies the names and associated parameters of filters that limit the messages
that are passed to the referenced appender.
Default None
name="ConversionPattern" value="conversion-pattern"
specifies formatting that is to be applied to the event before it is passed to the
referenced appender. The resulting string becomes the %m portion of the event
in the layout of the referenced appender.
name="Locale" value="locale"
specifies the locale that is used when the specified layout is applied to the event.
Defaults The locale setting that is in effect for the SAS session. For
example, the LOCALE system option might be specified in the
configuration file for a SAS server or in the configuration file for
Base SAS.
name="PropagateLayout" |
specifies whether the layout that is specified in the conversion pattern is to be
applied to events before they are passed to the referenced appender. Specify
one of the following values:
TRUE
applies the specified layout to events before they are passed to the
referenced appender. The resulting string becomes the %m portion of the
event in the layout of the referenced appender.
64 Chapter 6 / Appender Reference
FALSE
passes events to the referenced appender without applying the specified
layout. Messages are formatted only by the layout that is specified in the
referenced appender.
Default TRUE
name="Threshold" | | | | |
specifies the lowest event level that this appender processes. Events that are
below the specified level are ignored. The valid values are listed here from
lowest to highest.
Default None
Details
FilteringAppender enables you to do one or both of the following:
n filter events based on thresholds and string values to determine whether the
events should be passed to a referenced appender.
n apply a layout to events before they are passed to the referenced appender. The
resulting string becomes the %m portion of the event in the layout of the
referenced appender.
Since FilteringAppender is an intermediate appender rather than a logging
destination, it must be configured with an appender reference.
The primary use of FilteringAppender is to specify different layouts for different
categories of events that are to appear together in the same log. Specify a separate
instance of FilteringAppender for each event category that requires a different
layout. After the layout is applied, the resulting string becomes the %m portion of the
event in the layout of the referenced appender. You can specify filters to limit the
events that are passed.
If you do not specify a layout, or if you set the PropagateLayout parameter to
FALSE, then events are formatted only by the layout of the referenced appender.
Example
The following logging configuration file writes two different categories of events to
the same log file:
n Events from the App.Program logger. These events are written directly to the log
file.
n Events from loggers other than App.Program, if they contain the word “state.”
For these events, a layout is applied that includes the event's level and logger
followed by the message. The resulting string becomes the %m portion of the
event in the log file's layout.
<?xml version="1.0" encoding="UTF-8"?>
<logging:configuration xmlns:logging="http//support.sas.com/xml/logging/1.0">
<!-- Write just the message portion of the event to the log file. -->
IOMServerAppender 65
IOMServerAppender
Writes log messages from any IOM server to a volatile run time cache.
Valid in: XML configuration
Syntax
<appender class="IOMServer" name="appender-name">
<param name="MaxEntries" value="maximum-number of-entries"/>
<param name="Threshold" value="TRACE | DEBUG | INFO | WARN | ERROR |
FATAL"/>
<layout>
66 Chapter 6 / Appender Reference
Syntax Description
name="MaxEntries" value="maximum-number-of-entries"
an integer that specifies the maximum number of messages that are stored in
the cache. When the maximum number is reached, the oldest messages are
deleted as new messages are added.
Default 10000
Range 0 to 1000000
name="Threshold" | | | | |
specifies the lowest event level that this appender processes. Events that are
below the specified level are ignored. The valid values are listed here from
lowest to highest.
Default None
name="ConversionPattern" value="conversion-pattern"
specifies how the log message is written to the log.
Default None. If a conversion pattern is not specified, then the log event
produces an empty string.
Details
IOM Server Appender writes log messages from any IOM server (for example, a
SAS Metadata Server, a SAS OLAP Server, or a SAS Stored Process Server) to a
volatile run time cache. The contents of the cache are available for display on the
Log tab of SAS Management Console. For more information, see “Use the Log Tab
in Server Manager” in the SAS Intelligence Platform: System Administration Guide.
If you perform a planned deployment, then IOMServerAppender definitions are
included in the logging configurations for most of your SAS servers. Follow these
best practices when modifying these definitions:
n You can adjust the MaxEntries value to capture a larger or smaller number of
messages for display.
n Do not change the message layout. Changing the message layout could cause
messages to be captured incorrectly.
Note: A location for temporary files must be defined on the host operating system.
If a location has not been defined, then the process that is being logged fails with
JavaAppender 67
n On z/OS systems, create the directory /tmp if you are using a UNIX file system
(UFS); or submit the following TSO command:
ALLOC UNIT(SYSDA) BLOCK(8192) SPACE(1280,1280)
Example
The following instance of IOMServerAppender writes a maximum of 10,000
messages to a run time cache. When the cache contains 10,000 messages, the
oldest messages are deleted as new messages are added.
<appender class="IOMServerAppender" name="IOMServer">
<param name="MaxEntries" value="10000"/>
<layout>
<param name="ConversionPattern" value="%d %-5p [%t] %X{Client.ID}:%u - %m"/>
</layout>
</appender>
JavaAppender
Sends messages to a custom Java class.
Valid in: XML configuration
Syntax
<appender class="JavaAppender" name="appender-name">
<param name="Class" value="class"/>
<param name="ClassPath" value="class-path"/>
<param name="MaxBufferedEvents" value="maximum-buffered-events"/>
<param name="SASEncodedPassword" value="SAS-encoded-password"/>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
</appender>
Syntax Description
class="JavaAppender" name="appender-name"
specifies the user-assigned name for this instance of JavaAppender.
Default None
68 Chapter 6 / Appender Reference
name="Class" value="class"
specifies the custom Java class to which events are to be sent. The class that
you specify must support the following methods:
n A no-argument constructor for creating the object.
void setOption( String specifies the handling for any parameters in the
name, Object value ) configuration file that are not recognized by
JavaAppender
void activate() is called after all of the options have been set
and before any calls to the append method
void destroy is called when the appender is destroyed
Requirement This parameter is required if you want to use a class other than
com.sas.jms.logging.JMSAppender.
name="ClassPath" value="class-path"
specifies the path for classes that are included in this appender configuration.
Default None
name="MaxBufferedEvents" value="maximum-buffered-events"
specifies the maximum number of events that can be waiting to be sent to the
Java class. JavaAppender stores events in an internal list that is bounded by the
number that is specified in this parameter. A worker thread removes events from
the list and sends them to the Java class. In the meantime, SAS can continue
processing without waiting for the Java class. When the list contains the
specified number of events, the appender blocks further events until the list can
accommodate them.
Default Infinite
name="SASEncodedPassword" value="SAS-encoded-password"
specifies a plain-text password or a password that has been encoded by using
sas001, sas002, or sas003 encoding. If the password is encoded, JavaAppender
converts it to plain text before sending it to the Java class.
TIP For information about how to obtain the encoded password, see
“PWENCODE Procedure” in Base SAS Procedures Guide.
Default None.
name="ConversionPattern" value="conversion-pattern"
specifies how the log message is written to the Java class.
Default None. If a conversion pattern is not specified, then the log event
produces an empty string.
Details
If additional parameters are needed by your custom Java class, you can include
them in the appender configuration. Any parameters that JavaAppender does not
recognize are passed to the custom Java class.
Examples:
import javax.swing.JTextArea;
import java.awt.Font;
public TraceWindow(){
System.setProperty( "java.awt.headless", "false" );
separator = System.getProperty("line.separator");
}
class LogToJDBC {
String driver;
String url;
String tablename;
String username;
String password;
long rowsetsize;
long eventCount;
Connection connection;
PreparedStatement stmt;
public LogToJDBC() {
/*-------------------------------------------------------------+
| Nothing to do in the constructor. |
+-------------------------------------------------------------*/
}
/*-----------------------------------------------------------------+
| Appender API |
+-----------------------------------------------------------------*/
public void setOption( String name, Object value ) {
if( name.equalsIgnoreCase( "driver" ) ) {
driver = value.toString();
} else if( name.equalsIgnoreCase( "url" ) ) {
url = value.toString();
} else if( name.equalsIgnoreCase( "tablename" ) ) {
tablename= value.toString();
} else if( name.equalsIgnoreCase( "username" ) ) {
username = value.toString();
} else if( name.equalsIgnoreCase( "password" ) ) {
password = value.toString();
} else if( name.equalsIgnoreCase( "rowsetsize" ) ) {
rowsetsize = Long.valueOf(value.toString());
}
}
public void append( int level, String logger, String msg ) throws Exception {
/*-------------------------------------------------------------+
| Set the columns of our statement and if we have batched |
| enough rows then commit them to the data base. |
+-------------------------------------------------------------*/
stmt.setString( 1, new Integer(level).toString() );
stmt.setString( 2, logger );
stmt.setString( 3, msg );
stmt.addBatch();
eventCount++;
if( eventCount >= rowsetsize )
{
stmt.executeBatch();
connection.commit();
eventCount = 0L;
}
}
}
Step 3: Create the following logging configuration file. This file specifies
JavaAppender with the custom Java class LogToJDBC, which is displayed in the
preceding code. The Driver, URL, TableName, UserName, Password, and
RowSetSize parameters are passed to LogToJDBC, which uses them to connect to
the server and to write to the table.
<?xml version="1.0" encoding="UTF-8" ?>
<logging:configuration xmlns:logging="http://www.sas.com/xml/logging/1.0/">
Example 3: Sending Events to log4j Appenders 73
case 6:
l.log( Level.ERROR, msg );
break;
case 7:
l.log( Level.FATAL, msg );
break;
}
}
}
Step 2: Create a SAS logging configuration file called socket.xml. In the file, specify
JavaAppender with the custom Java class SendToLog4j.
<?xml version="1.0"?>
<logging:configuration xmlns:logging="http://www.sas.com/xml/logging/1.0/"
threshold="trace">
<appender name="java" class="JavaAppender">
<param name="class" value="SendToLog4j"/>
<layout>
<param name="ConversionPattern" value="%d - %S{hostname} - %S{pid}
- %c - %m"/>
</layout>
</appender>
<root>
<level value="info"/>
<appender-ref ref="java"/>
</root>
</logging:configuration>
Step 3: Create a client-side log4j configuration file called client.properties. In the file,
specify the use of SocketAppender to listen for events.
log4j.rootLogger=DEBUG,A2
log4j.appender.A2=org.apache.log4j.net.SocketAppender
log4j.appender.A2.Port=55555
log4j.appender.A2.RemoteHost=localhost
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Step 4: Create a server-side log4j configuration file called server.properties. In the
file, specify the use of ConsoleAppender. (Any log4j appender could be specified.)
log4j.rootLogger=DEBUG,A2
log4j.appender.A2=org.apache.log4j.net.SocketAppender
log4j.appender.A2.Port=55555
log4j.appender.A2.RemoteHost=localhost
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Step 5: Use the following command to start the socket server. The command
specifies the server.properties log4j configuration file.
java –classpath log4j.jar org.apache.log4j.net.SocketServer 55555
server.properties
Step 6: Specify the following options when you start SAS. The first option specifies
the socket.xml logging configuration file, and the second option passes the
client.properties log4j configuration file to the SAS Java environment.
-logconfigloc socket.xml
-jreoptions '(-Dlog4j.configuration=client.properties)'
JMSAppender 75
JMSAppender
Sends messages to a message queue by using the Java Message Service (JMS) interfaces.
Valid in: XML configuration
Syntax
<appender class="JMSAppender" name="appender-name">
<param name="ClassPath" value="class-path"/>
<param name="MaxBufferedEvents" value="maximum-buffered-events"/>
<param name="Persistent” value="TRUE | FALSE"/>
<param name="Factory" value="factory"/>
<param name="Queue | Destination" value="queue-name"/>
<param name="UserName" value="user-name"/>
<param name="SASEncodedPassword" value="SAS-encoded-password"/>
<param name="Prioritize” value="TRUE | FALSE"/>
<param name="Priority" value="priority"/>
<param name="TimeToLive" value="time-to-live"/>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
</appender>
Syntax Description
class="JMSAppender" name="appender-name"
specifies the user-assigned name for this instance of JMSAppender.
Default None
name="ClassPath" value="class-path"
specifies the path for classes that are included in this appender configuration.
Default None
name="MaxBufferedEvents" value="maximum-buffered-events"
specifies the maximum number of events that can be waiting to be sent to the
message queue. JMSAppender stores events in an internal list that is bounded
by the number that is specified in this parameter. A worker thread removes
events from the list and sends them to the message queue. In the meantime,
76 Chapter 6 / Appender Reference
SAS can continue processing without waiting for the JMS provider. When the list
contains the specified number of events, the appender blocks further events until
the list can accommodate them.
Default Infinite
name="Persistent" |
specifies whether the persistent delivery mode is to be used to send messages
to the queue.
TRUE
specifies the use of the persistent delivery mode to send messages to the
queue. This mode instructs the JMS provider to store messages after they
are sent to ensure that they are not lost in transit if a provider failure occurs.
FALSE
specifies the use of the nonpersistent delivery mode to send messages to the
queue. If you specify this mode, the JMS provider is not required to store
messages or otherwise guarantee that they will be preserved if the provider
fails.
Default TRUE
name="Factory" value="factory"
specifies the name of a connection factory that is administered through the Java
Naming and Directory Interface (JNDI) and that is to be used to connect to the
message queue.
Default None
name="Queue" value="queue-name"
specifies the name of the JNDI-administered queue to which messages are to be
sent.
Alias name="Destination"
JMSAppender 77
Default None
name="Username" value="user-name"
specifies the user name that is to be used to connect to the message queue.
Default If a user name is not specified, then the user name of the process
owner is used to connect to the message queue.
name="SASEncodedPassword" value="SAS-encoded-password"
specifies the password that is to be used with user-name to connect to the
message queue. You can specify a plain-text password or a password that has
been encoded by using sas001, sas002, or sas003 encoding. If the password is
encoded, JMSAppender converts it to plain text before connecting to the queue.
TIP For information about how to obtain the encoded password, see
“PWENCODE Procedure” in Base SAS Procedures Guide.
Default None.
name="Prioritize" |
specifies whether messages are to be prioritized based on the level of the event.
TRUE
sets the message priority based on the level of the event, as follows:
Trace 2
Debug 3
Info 4
Warn 5
Error 6
Fatal 7
Default FALSE
Interaction If both the Prioritize parameter and the Priority parameter are
specified, then the Priority parameter takes precedence.
name="Priority" value="priority"
specifies an integer that is to be assigned as the message priority for each
message that is written to the queue.
Range 0–9
Interaction If both the Prioritize parameter and the Priority parameter are
specified, then the Priority parameter takes precedence.
name="TimeToLive" value="time-to-live"
specifies the message time-to-live in milliseconds. When a message is sent,
JMS computes the message’s expiration time by adding the time-to-live value to
the current Greenwich Mean Time. If time-to-live is specified as zero, the
message does not expire.
Default 0
name="ConversionPattern" value="conversion-pattern"
specifies how the log message is written to the queue.
Default None. If a conversion pattern is not specified, then the log event
produces an empty string.
Details
If additional JNDI parameters (for example, java.naming.factory.initial or
java.naming.provider.url) are needed by your messaging provider, you can include
them in the appender configuration. Any parameters that JMSAppender does not
recognize are passed to the javax.naming.InitialContext constructor in the JNDI
initial context as part of the Hashmap parameter.
Note: You can also use the JREOPTIONS system option to pass JNDI parameters
directly to SAS. See the following topics:
n “JREOPTIONS System Option: Windows” in SAS Companion for Windows
Depending on the provider, you might be able to use other methods to specify these
parameters.
See also:
n http://java.sun.com/products/jms for details about the Java Message Service.
n Application Messaging with SAS for details about SAS language interfaces to
JMS.
Examples:
<layout>
<param name="ConversionPattern" value="%d - %c -%m"/>
</layout>
</appender>
80 Chapter 6 / Appender Reference
<layout>
<param name="ConversionPattern" value="%d - %c - %m"/>
</layout>
</appender>
RabbitmqAppender
Writes log messages to a Rabbitmq broker.
Note: The RabbitmqAppender writes log messages as JSON objects to a Rabbitmq broker.
The layout described in the appender definition defines how the JSON records should be
created. It is pre-determined, and should not be modified without the guidance of
technical support.
CAUTION: Do not modify the RabbitmqAppender without the assistance of technical support.
RollingFileAppender
Writes messages to the specified file in the specified path, and begins writing messages to a new file that
has a different name when specified criteria are met.
Valid in: XML configuration
RollingFileAppender 81
Syntax
<appender class="RollingFileAppender" name="appender-name">
<param name="Append" value="TRUE | FALSE"/>
<param name="Encoding" value="encoding-value"/>
<param name="File" value="path-and-filename"/>
<param name="FilePermissions" value="permission-value-1,permission-
value-2..."/>
<param name="ImmediateFlush" value="TRUE | FALSE"/>
<param name="Locale" value="locale"/>
<param name="Threshold" value="TRACE | DEBUG | INFO | WARN | ERROR |
FATAL"/>
<param name="Unique" value=""TRUE | FALSE"/>
<filter>
<filter-definitions>
</filter>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
<rollingPolicy class="FixedWindowRollingPolicy | TimeBasedRollingPolicy">
<rollingPolicy-parameters>
</rollingPolicy>
<triggeringPolicy class="SizeBasedTriggeringPolicy |
FilterBasedTriggeringPolicy">
<triggeringPolicy-parameters>
</triggeringPolicy>
</appender>
Syntax Description
class="RollingFileAppender" name="appender-name"
specifies the user-assigned name for this instance of RollingFileAppender.
Default None
name="Append" |
controls how messages are committed to the log file if the file already exists
when logging begins. Specify one of the following values:
TRUE
appends new messages to the end of the existing file.
FALSE
erases the contents of the existing file and overwrites them with new
messages.
Default TRUE
Interaction If both the Unique parameter and the Append parameter are
specified, then the Unique parameter takes precedence. For
details, see the Unique parameter on page 84.
name="Encoding" value="encoding-value"
specifies the encoding that is used to write messages to the file.
Defaults The encoding setting that is in effect for the SAS session. For
example, the ENCODING system option might be specified in the
configuration file for a SAS server or for Base SAS. If the
ENCODING system option is not specified for the SAS session,
then the defaults that are described in the SAS National Language
Support (NLS): Reference Guide are used.
name="File" value="path-and-filename"
specifies the path and filename of the file to which messages are written.
Default None
Interaction This filename overwrites any value that you specify for path-and-
filename-pattern in a RollingPolicy or TriggeringPolicy
configuration.
name="FilePermissions" value="permission-value-1,permission-value-2..."
specifies one or more sets of permissions to set for the log file. To specify more
than one set, separate them with a comma within the quotation marks. Use the
following syntax for each permission value:
A::<trustee_type>::<permissions>
A
indicates that these are access permissions. No other values are supported.
trustee_type
indicates which users the permissions apply to. The following values are
supported:
u the user whose credentials are being used to generate the log file.
o all other users. On UNIX systems, this value includes all users except
those specified by u and g. On Windows systems, this value includes
all users including those specified by u and g.
permissions
the permission string that applies to the trustee type. The permission string
takes the values r (Read), w (Write), and x (Execute), in that order. If you do
RollingFileAppender 83
not want to grant one of these permissions, enter a hyphen (-) in its place.
For example, specify r‑x or rw‑.
Note: The specified file permissions take effect only when a new file is being
created or when the current user is the owner of the existing file.
Default If this parameter is not specified, the logging facility does not apply any
permissions other than those that are applied by the operating system.
See For additional details and examples, see the PERMISSION argument in
the following documentation topics: “FILE Statement: Windows” in SAS
Companion for Windows and “FILE Statement: UNIX” in SAS Companion
for UNIX Environments.
Example The following parameter sets permissions that enable only the owning
user to write to the log file. All other users can only read the file.
<param name="FilePermissions" value="A::u::rw-,A::g::r--,A::o::r--"/>
name="ImmediateFlush" |
determines whether messages are written to the file immediately or held in a
buffer. Specify one of the following values:
TRUE
writes messages to the file immediately as they are received.
FALSE
holds messages in a buffer and writes them to the file when the buffer is full.
The default buffer size is 16 KB.
Default FALSE
name="Locale" value="locale"
specifies the locale that is used to write messages to the file.
Defaults The locale setting that is in effect for the SAS session. For
example, the LOCALE system option might be specified in the
configuration file for a SAS server or for Base SAS.
name="Threshold" | | | | |
specifies the lowest event level that this appender processes. Events that are
below the specified level are ignored. The valid values are listed here from
lowest to highest.
Default None
84 Chapter 6 / Appender Reference
name="Unique" |
creates a new file, with an underscore and a unique number appended to the
filename, if the log file already exists when logging begins. Numbers are
assigned sequentially from 0 to 32766.
For example, suppose Events_%d.log is specified in path-and-filename-pattern
for TimeBasedRollingPolicy. If the current date is August 3, 2008, and a file
already exists that has the name Events_20080803.log, then the next log file
that is created is named Events_20080803_0.log. If a file already exists that has
the name Events_20080803_0.log, then the next log file that is created is
named Events_20080803_1.log.
Default FALSE
Interactions If both the Unique parameter and the Append parameter are
specified, then the Unique parameter takes precedence. If the log
file already exists when logging begins, and if Unique is set to
TRUE, then messages are written to a new file with a unique
number appended to the filename. This occurs whether Append is
set to TRUE or FALSE.
filter-definitions
specifies the names and associated parameters of filters that limit the messages
that are logged by this appender.
Default None
name="ConversionPattern" value="conversion-pattern"
specifies how the log message is written to the log.
Default None. If a conversion pattern is not specified, then the log event
produces an empty string.
rollingPolicy class= |
specifies the policy that controls the creation of new log files and filenames when
messages roll over to a new file. SAS provides the following instances of
rollingPolicy:
n FixedWindowRollingPolicy on page 85
RollingFileAppender 85
n TimeBasedRollingPolicy on page 86
FixedWindowRollingPolicy
specifies a fixed set of filenames that include sequentially assigned index
numbers. To specify when log files roll over, specify either
SizeBasedTriggeringPolicy or FilterBasedTriggeringPolicy in the
TriggeringPolicy parameter. When the specified criteria are met, the log files are
rolled over as follows:
n The appender renames each existing log file by incrementing the index
number in the filename by 1. For example, Events03.log is renamed to
Events04.log , Events02.log is renamed to Events03.log , and
Events01.log is renamed to Events02.log.
n If a file already exists that has a filename that includes maximum-index, then
the messages in that file are overwritten. For example, if Events04.log
already exists when rollover occurs, and if 4 is specified in maximum-index,
then the contents of Events04.log are replaced with the contents of
Events03.log.
n The appender creates a new file with minimum-index in the filename (for
example, Events01.log ), and subsequent messages are written to that file.
Use the following syntax to specify FixedWindowRollingPolicy:
<rollingPolicy class="FixedWindowRollingPolicy">
<param name="FileNamePattern" value="path-and-filename-pattern"/>
<param name="maxIndex" value="maximum-index"/>
<param name="minIndex" value="minimum-index"/>
</rollingPolicy>
name="FileNamePattern" value="path-and-filename-pattern"
specifies the path to which the log file is written and the conversion pattern
that is used to create the log filename when messages roll over to a new file.
The conversion pattern can include the following characters:
%i
indicates where the index number is to appear. The index number is
incremented by 1 each time a new file is created.
%S{key}
indicates where system information (such as the host name, operating
system, or system description) appears. You must specify a key to
indicate the type of system information that appears.
Default None
name="maxIndex" value="maximum-index"
specifies an integer that is the highest number to be used as an index in the
log filename. For example, if you set minimum-index to 1 and maximum-
index to 10, the appender creates a maximum of ten log files. When the
maximum has been reached, the appender overwrites the most recently
created file.
Default 7
Range 1–14
name="minIndex" value="minimum-index"
specifies an integer that is the beginning number to be used as an index in
the log filename. For example, if you set minimum-index to 3, the name of the
first log file that is created will contain the characters 03 in the position that is
specified by %i in the filename pattern.
Default 1
Range 1–14
When logging first begins, the following empty files are created:
Events01.log , Events02.log , Events03.log , and Events04.log.
Messages are written to Events01.log and are rolled over to the
other files in the group as specified by the triggering policy.
The next time logging begins, the following set of files is created
and written to Events01_0.log , Events02_0.log , Events03_0.log ,
and Events04_0.log.
TimeBasedRollingPolicy
specifies the use of a log filename that contains the current date. You do not
need to specify a value for triggeringPolicy when you use this policy. To specify
when a new log file is created, you can specify either of the following options:
RollingFileAppender 87
n Creation of (rollover to) a new log file whenever the generated filename
differs from the current filename. This is the default behavior.
For example, if the filename includes the current year, month, and day, then a
new file is created when the system date changes to a new day.
n Creation of a new log file only when a new session begins.
See
%S{key}
indicates where system information (such as the host name, operating
system, or system description) appears. You must specify a key to
indicate the type of system information that appears.
Default None
name="rollOver" |
indicates whether a new log file is created whenever the generated filename
differs from the current filename. Specify one of the following values:
TRUE
creates (rolls over to) a new file whenever the generated filename differs
from the current filename.
88 Chapter 6 / Appender Reference
FALSE
creates a new log file only when a new session begins.
Default TRUE
triggeringPolicy class= |
specifies the policy that determines when a new log file is created. SAS provides
the following instances of triggeringPolicy:
n SizeBasedTriggeringPolicy on page 88
n FilterBasedTriggeringPolicy on page 88
SizeBasedTriggeringPolicy
specifies the creation of a new log file when the number of bytes in the current
log file is greater than or equal to the specified maximum-file-size. Along with this
policy, specify FixedWindowRollingPolicy in the RollingPolicy parameter to
control how new log filenames are assigned and the number of files that are
created.
Use the following syntax to specify SizeBasedTriggeringPolicy:
<triggeringPolicy class="SizeBasedTriggeringPolicy">
<param name="MaxFileSize" value ="maximum-file-size">
</triggeringPolicy>
name="MaxFileSize" value ="maximum-file-size"
specifies the maximum size, in bytes, of the log file. When the log file reaches
this size, messages roll over to a new file. You can use the suffix KB (for
kilobytes), MB (for megabytes), or GB (for gigabytes) when you are specifying
the size. For example, 10KB is interpreted as 10240 bytes.
FilterBasedTriggeringPolicy
specifies the creation of a new log file when a log event is received that meets
the specified filtering criteria. Along with this policy, specify
FixedWindowRollingPolicy in the RollingPolicy parameter to control how new log
filenames are assigned and the number of files that are created.
Use the following syntax to specify FilterBasedTriggeringPolicy:
<triggeringPolicy class="FilterBasedTriggeringPolicy">
<filter-definitions>
</triggeringPolicy>
filter-definitions
specifies the filters that are used to trigger rollover to a new log file.
Details
You can configure an instance of RollingFileAppender to do the following:
n roll over to a new log file when the system date or time changes (for example,
every day or every hour)
n roll over to a new log file when a new session begins
n roll over to a new log file when the file reaches a specified size
Example 2: Roll Over to a New Log When a New Session Begins 89
n roll over to a new log file when log events match the specified filtering criteria
Examples:
Example 3: Roll Over to a New Log File When the File Reaches a
Specified Size
In this example, RollingFileAppender writes messages to a log file whose name
contains an index number. The first file that is created is called
MetadataServer_01.log. When the size of MetadataServer_01.log is greater than
or equal to 100 KB, the file is renamed to MetadataServer_02.log, and subsequent
messages are written to a newly created instance of MetadataServer_01.log.
The next time MetadataServer_01.log reaches or exceeds 100 KB,
MetadataServer_02.log is renamed to MetadataServer_03.log,
MetadataServer_01.log is renamed to MetadataServer_02.log, and subsequent
messages are written to a newly created instance of MetadataServer_01.log.
Rollover continues until nine files have been created, at which point the contents of
MetadataServer_09.log are overwritten when rollover occurs.
<!-- Rolling log file based on log file size -->
<appender class="RollingFileAppender" name="FixedWindowRollingFile">
<param name="Append" value="true"/>
<param name="ImmediateFlush" value="true"/>
<rollingPolicy class="FixedWindowRollingPolicy">
<param name="FileNamePattern" value="c:\logs\MetadataServ_%i.log"/>
<param name="minIndex" value="1"/>
<param name="maxIndex" value="9"/>
</rollingPolicy>
<triggeringPolicy class="SizeBasedTriggeringPolicy">
<param name="MaxFileSize" value="100KB"/>
</triggeringPolicy>
<layout>
<param name="ConversionPattern" value="%d %-5p [%t] %u - %m"/>
</layout>
</appender>
sLogAppender
Is a reserved class. You should not define new instances of this appender.
Note: Various appender definitions that rely on sLogAppender are enabled by default for
several SAS servers. These appender definitions enable SAS client and SAS middle tier
applications to access SAS server internal logging facilities.
CAUTION: Do not modify sLogAppender definitions that are provided in default logging
configuration files. Modifying these definitions results in unpredictable behavior.
UNXFacilityAppender
Writes messages to the syslogd logging facility in UNIX operating systems.
Valid in: XML configuration
UNXFacilityAppender 91
Syntax
<appender class="UNXFacilityAppender" name="LOG">
<param name="facilitycode" value="log_value"/>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
</appender>
Syntax Description
name="facilitycode" value="log_value"
The facilitycode configuration option specifies the system facility value that
generated the message. It can have any of the following log values:
LOG_USER
specifies that messages that are generated by user processes are logged.
LOG_USER is the default value for facilitycode.
LOG_LOCAL0 through LOG_LOCAL7
specifies values that are reserved for use by your site.
See For information about the generic elements of the appender syntax, see
“General Appender Syntax” on page 13
Details
UNXFacilityAppender Usage
UNXFacilityAppender is supported on the Solaris, HP, Linux, and AIX operating
systems. The logging facility that these operating systems provide is named
syslogd. The syslogd daemon must be running before you can see the output that
is sent to it by UNXFacilityAppender. To enable UNXFacilityAppender to
communicate with syslogd, make sure that the /etc/syslog.conf file contains one
or more of the following entries:
n an entry for the user facility
Note: Use caution when specifying *. It can cause facilities other than user and
local0 through local7 to log to the destination.
or
*.info /tmp/allinfo.log
For more information about syslogd on the UNIX platform that you are using, see
the documentation written by that provider.
92 Chapter 6 / Appender Reference
INFO info
WARN warning
ERROR err
FATAL crit
no level notice
Example
The following example is a typical XML configuration file that specifies
UNXFacilityAppender.
<appender class="UNXFacilityAppender" name="LOG">
<layout>
<param name="ConversionPattern"
value="%d %-5p [%t] %c - %m"/>
</layout>
</appender>
<root>
WindowsEventAppender 93
<level value="trace"/>
<appender-ref ref="LOG"/>
</root>
WindowsEventAppender
Writes messages to the Windows Event log.
Valid in: XML configuration
Syntax
<appender class="WindowsEventAppender" name="eventAppender">
</appender>
Syntax Description
For information about the generic elements of the appender syntax, see “General
Appender Syntax” on page 13.
Details
WindowsEventAppender is a logging facility appender that supports event logging
on Windows operating systems.
WindowsEventAppender sends events to the Windows event log. The event log
might be easily overloaded. You should configure WindowsEventAppender so that
the event log does not receive more events than it can handle.
Example
The following example is a typical XML configuration file that specifies the
WindowsEventAppender. The parameter identifies the role of SAS as the SAS
Foundation.
<?xml version="1.0" encoding="UTF-8"?>
<logging:configuration
xmlns:logging="http://www.sas.com/xml/logging/1.0/">
<appender name="eventLog" class="WindowsEventAppender">
<layout>
<param name="ConversionPattern"
value="%d %-5p [%t] %c (%F:%L) - %m"/>
</layout>
</appender>
<root>
<level value="trace"/>
<appender-ref ref="eventLog"/>
</root>
</logging:configuration>
94 Chapter 6 / Appender Reference
ZOSFacilityAppender
Enables multiple instances of SAS in the z/OS operating system to write messages to a common location.
Valid in: XML configuration
Syntax
<appender class="ZOSFacilityAppender" name="appender-name">
<param name="stream" value="stream-name"/>
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout
</appender>
Syntax Description
name="stream" value="stream-name"
specifies the log stream for ZOSFacilityAppender.
Restriction The log stream must be defined, using the IBM IXCMIAPU utility.
See For information about the generic elements of the appender syntax,
see “General Appender Syntax” on page 13.
Details
ZOSFacilityAppender is a logging facility appender that supports event logging on
z/OS operating systems. ZOSFacilityAppender enables multiple instances of SAS in
the z/OS environment to write log information to a common location. If the z/OS
environment uses the coupling facility, all of the SAS jobs that run on all of the z/OS
systems that are on the sysplex can write their logs to the same location.
To use z/OS Facility Appender, specify a class of ZOSFacilityAppender that has a
stream parameter that names the z/OS log stream that is used. You can define
coupling facility (CF) log streams or DASD-only log streams for use with
ZOSFacilityAppender. RACF access must be granted to any SAS user or batch SAS
job that writes to the system logger.
Examples:
ZOSWtoAppender
Directs SAS application messages to the z/OS operating system console.
Valid in: XML configuration
See: For more information about the z/OS write-to-operator (WTO) service macro and the
parameters that are listed here, see the IBM reference document, MVS Assembler
Services Reference.
For information about the generic elements of the appender syntax, see “General
Appender Syntax” on page 13.
Syntax
<appender class=" ZOSWtoAppender" name="appender-name">
<layout>
<param name="ConversionPattern" value="conversion-pattern"/>
</layout>
<param name="routecode" value="value"/>
<param name="desccode" value="value"/>
<param name="mcsflag" value="HRDCPY | BRDCST | NOTIME/>
</appender>
Syntax Description
name="routecode" value="value"
specifies the routing code that is used for ZOSWtoAppender messages.
name="desccode" value="value"
specifies the descriptor code that is used for ZOSWtoAppender messages.
ZOSWtoAppender 97
name="mcsflag" value="value"
specifies the mcs flag that is used for ZOSWtoAppender messages. Valid values
for the mcs flag parameter are HRDCPY, BRDCST, NOTIME, and BUSYEXIT.
Details
ZOSWtoAppender is a logging facility appender that supports event logging on z/OS
operating systems. ZOSWtoAppender enables you to direct SAS application
messages, such as automation messages in the Admin message category, to the
operating system consoles. ZOSWtoAppender uses the z/OS write-to-operator
(WTO) service macro to direct the messages to the consoles. The appender also
enables SAS servers to send messages about the status of applications to z/OS for
automation purposes.
The “routecode”, “desccode”, and “mcsflag” parameters can be included multiple
times in your XML file. For example, you can have multiple “routecode” parameters
if you want to specify more than one routing code.
Example
The following example initiates ZOSWtoAppender; specifies a conversion pattern;
specifies the name of the logger; and specifies values for the “routecode”,
“desccode”, and “mcsflag” parameters.
<appender name="WTO" class="ZOSWtoAppender">
<layout>
<param name=ConversionPattern"
value="%d %-5p [%t] %c (%F:%L) — %m"/>
</layout>
<param name="routecode" value="11"/>
<param name="desccode" value="7"/>
<param name="mcsflag" value="HRDCPY"/>
</appender>
<logger name ="ADMIN.OPERATIONS">
<level value="trace"/>
<appender-ref ref="WTO"/>
</logger>
98 Chapter 6 / Appender Reference
99
7
Database Connection Options
Reference for DBAppender
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
DBAppender Connection Options for DB2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
DBAppender Connection Options for ODBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
DBAppender Connection Options for Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
DBAppender Connection Options for SAS Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
DBAppender Connection Options for Teradata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Dictionary
Syntax
CATALOG=catalog-identifier;
DATABASE=database-specification;
DRIVER=DB2;
PWD=password;
UID=user-id;
CONOPTS=(valid-DB2-compliant-database-connection-string);
Syntax Description
The data source connection options for a DB2 database include the following:
CATALOG=catalog-identifier
specifies an arbitrary identifier for an SQL catalog, which groups logically related
schemas. Any identifier is valid (for example, catalog=db2).
100 Chapter 7 / Database Connection Options Reference for DBAppender
Requirement You must specify a catalog. For the DB2 database, this is a logical
catalog name to use as an SQL catalog identifier.
DATABASE=database-specification
Specifies the name of the DB2 database.
Alias DB=
DRIVER=DB2;
identifies the data source to which you want to connect, which is a DB2
database.
PWD=password;
specifies the DB2 password.
UID=user-id;
specifies the DB2 login user ID.
CONOPTS=(valid-DB2-compliant-database-connection-string);
specifies, within parentheses, a DB2 connection string. This parameter enables
you to specify connection options that cannot be specified with the other
ConnectionString parameters.
For example, you can use this parameter as follows to specify a DSN called
logdata:
CONOPTS=(DSN=logdata);
Syntax
CATALOG=catalog-identifier;
ODBC_DSN=ODBC-DSN-name
DRIVER=ODBC;
PWD=password;
UID=user-id;
CONOPTS=(valid-ODBC-compliant-database-connection-string);
DBAppender Connection Options for ODBC 101
Syntax Description
The data source connection options for an ODBC-compliant database include the following:
CATALOG=catalog-identifier
specifies an arbitrary identifier for an SQL catalog, which groups logically related
schemas.
For the Microsoft SQL Server, you can specify a logical name for the catalog,
and map it to the native catalog name that is defined in the SQL Server. For
example, to specify the logical catalog logcat and map it to a native catalog
called sqlcat, you would specify the following:
catalog=(logcat=sqlcat);
For databases that do not support native catalogs, any identifier is valid (for
example, catalog=myodbc).
Default If this parameter is omitted for the Microsoft SQL Server, the
default setting CATALOG=* is used.
ODBC_DSN=ODBC-DSN-name
specifies a valid ODBC-compliant database DSN that contains information for
connecting to the ODBC-compliant database.
DRIVER=ODBC;
identifies the type of data source to which you want to connect, which is ODBC.
PASSWORD=password;
specifies the password that is associated with the user ID.
Alias PWD=
USER=user-id;
specifies the user ID for logging on to the ODBC-compliant database.
Alias UID=
Default If no user ID is specified, the default user ID for the database is used to
log on.
CONOPTS=(valid-ODBC-compliant-database-connection-string);
specifies, within parentheses, an ODBC-compliant database connection string.
This optional parameter enables you to specify connection options that cannot
be specified with the other ConnectionString parameters. Here is an example:
n If the database uses a DSN, you can use this parameter to specify a value for
DSN= or FILESDSN=. Here is an example:
102 Chapter 7 / Database Connection Options Reference for DBAppender
CONOPTS=(DSN=LogSql);
n For databases that do not use a DSN, use this parameter to specify the
DRIVER= keyword. Here is an example:
CONOPTS=(DRIVER=SQL Server);
Syntax
CATALOG=catalog-identifier;
DRIVER=ORACLE;
PATH=database-specification;
PWD=password;
UID=user-id;
Syntax Description
The data source connection options for an Oracle database include the following:
CATALOG=catalog-identifier;
specifies an arbitrary identifier for an SQL catalog, which groups logically related
schemas. Any identifier is valid (for example, catalog=oracle_log).
Requirement You must specify a catalog. For the Oracle database, this is a
logical catalog name to use as an SQL catalog identifier.
DRIVER=ORACLE;
identifies the data source to which you want to connect, which is an Oracle
database.
PATH=database-specification;
specifies the Oracle connect identifier. A connect identifier can be a net service
name, a database service name, or a net service alias.
DBAppender Connection Options for SAS Tables 103
PWD=password;
specifies the Oracle database password that is associated with user ID that is
specified in UID=.
Default If this parameter is not specified, then the password for the default
Oracle user ID (OPS$sysid) is used, if it is enabled.
UID=user-id;
specifies an Oracle user ID. If the user ID contains blanks or national characters,
enclose it in quotation marks.
Default If this parameter is not specified, then the default Oracle user ID
(OPS$sysid) is used, if it is enabled.
Syntax
CATALOG=catalog-identifier;
DRIVER=BASE;
SCHEMA=(NAME=schema-name;PRIMARYPATH=schema-path);
Syntax Description
The data source connection options for a SAS table include the following:
CATALOG=catalog-identifier;
specifies an arbitrary identifier for the SAS catalog. Any identifier is valid (for
example, catalog=base).
DRIVER=BASE;
identifies the data source to which you want to connect, which is a Base SAS
table.
SCHEMA=(NAME=schema-name;PRIMARYPATH=schema-path);
specifies the name and path for the schema. Any name is valid (for example,
name=MySchema). For PRIMARYPATH=, specify the path where the SAS table is
located, relative to the local machine.
Syntax
CATALOG=catalog-identifier;
DATABASE=database-name;
DRIVER=TERADATA;
PASSWORD=password;
SERVER=Teradata-server-identifier;
USER=user-id;
Syntax Description
The data source connection options for a Teradata database include the following:
CATALOG=catalog-identifier;
specifies an arbitrary identifier for an SQL catalog, which groups logically related
schemas. Any identifier is valid (for example, catalog=tera).
DATABASE=database-name;
specifies the Teradata database. If this option is not specified, a connection is
made to the default Teradata database for the user ID that is associated with the
process. If the database name contains spaces or non-alphanumeric characters,
you must enclose it in quotation marks.
DRIVER=TERADATA;
identifies the data source to which you want to connect, which is a Teradata
database.
PASSWORD=password;
specifies a Teradata password. The password that you specify must be correct
for your USER= value.
Alias PWD=
SERVER=Teradata-server-identifier;
specifies the Teradata server identifier.
USER=user-id;
specifies a Teradata user ID. If the user ID contains blanks or national
characters, enclose it in quotation marks.
Alias UID=
8
Pattern Layouts
Note: The conversion patterns that you use to format log messages are also similar
to, but not identical to, these formatting methods that are used in these contexts:
n the directives that are used in the SAS LOGPARM= system option to format log
names.
n the set of conversion patterns that are used by the ARMAppender. For details,
see “ARM Appender Pattern Layouts for ARM Messages” in SAS Interface to
Application Response Measurement (ARM): Reference.
The meaning of a specific character that is used in a pattern can vary according to
the context. Do not interchange characters.
SAS issues an error message if the message layout fails.
Here is an example of a formatted log event that is delivered to the appropriate
output device:
Thread Filename or
Date Level ID Logger Line Number Message
<layout>
<param name="HeaderPattern" value="DEFAULTHEADER"/>
<param name="ConversionPattern" value="DEFAULT"/>
</layout>
</appender>
CBE101FOOTER </CommonBaseEvents>
CBE101CORRELATORSFOOTE </CommonBaseEvents>
R
A FooterPattern parameter value
to use with ARM correlators and
Common Base Event 1.0.1.
CBE111 <cbe:CommonBaseEvent>%n
<sourceComponentId%n
A ConversionPattern parameter component="%S{TKIOM.SERVER_COMPONENT_NAME|SAS}
value to use with Common Base #%S{sup_ver_long2},%S{version}"%n
Event V1.1.1. subComponent="%c"%n
componentIdType="Logger"%n
location="%S{hostname}"%n
locationType="Hostname"%n
processId="%S{pid}"%n
threadId="%0.1t"%n
application="%S{App.Name|SAS}"/>%n
<situationInformation%n
creationTime="%d{ISO8601ZONEDOT}"%n
severity="%0.1severity{CBE}"%n
sequenceNumber="%0.1sn"%n
msg="%m">%n
<contextDataElements name="ServerType" type="clsid">%n
<contextValue>%S{TKIOM.BASE_CLSID}</contextValue>%n
</contextDataElements>%n
<contextDataElements name="ServerPort" type="number">%n
<contextValue>%S{TKIOM.PORT}</contextValue>%n
</contextDataElements>%n
<contextDataElements name="ServerKnownBy" type="string">%n
<contextValue>%S{TKIOM.KNOWN_BY}</contextValue>%n
</contextDataElements>%n
<contextDataElements name="UserId" type="string">%n
<contextValue>%u</contextValue>%n
</contextDataElements>%n
<situationType category="REPORT"%n
successDisposition="SUCCESSFUL"%n
situationQualifier="LOG"%n
reasoningScope="INTERNAL"/>%n
</situationInformation>%n
</cbe:CommonBaseEvent>
CBE111FOOTER </cbe:CommonBaseEvents>
CBE111CORRELATORS <cbe:CommonBaseEvent>%n
<sourceComponentId%n
A ConversionPattern parameter component="%S{TKIOM.SERVER_COMPONENT_NAME|SAS}
value to use for ARM correlators #%S{sup_ver_long2},%S{version}"%n
and Common Base Event subComponent="%c"%n
V1.1.1. componentIdType="Logger"%n
location="%S{hostname}"%n
locationType="Hostname"%n
processId="%S{pid}"%n
threadId="%0.1t"%n
application="%S{App.Name|SAS}"/>%n
<situationInformation%n
creationTime="%d{ISO8601ZONEDOT}"%n
severity="%0.1severity{CBE}"%n
sequenceNumber="%0.1sn"%n
msg="%m">%n
<contextDataElements name="ServerType" type="clsid">%n
<contextValue>%S{TKIOM.BASE_CLSID}</contextValue>%n
</contextDataElements>%n
<contextDataElements name="ServerPort" type="number">%n
<contextValue>%S{TKIOM.PORT}</contextValue>%n
</contextDataElements>%n
<contextDataElements name="ServerKnownBy" type="string">%n
<contextValue>%S{TKIOM.KNOWN_BY}</contextValue>%n
</contextDataElements>%n
<contextDataElements name="UserId" type="string">%n
<contextValue>%u</contextValue>%n
</contextDataElements>%n
<contextDataElements name="ParentCorrelator" type="string">%n
<contextValue>%X{ARM.ParentCorrelator}</contextValue>%n
</contextDataElements>%n
<contextDataElements name="CurrentCorrelator" type="string">%n
<contextValue>%X{ARM.CurrentCorrelator}</contextValue>%n
</contextDataElements>%n
<situationType category="REPORT"%n
successDisposition="SUCCESSFUL"%n
situationQualifier="LOG"%n
reasoningScope="INTERNAL"/>%n
</situationInformation>%n
</cbe:CommonBaseEvent>
CBE111CORRELATORSFOOTE </cbe:CommonBaseEvents>
R
A FooterPattern parameter value
to use for ARM correlators and
Common Base Event V1.1.1.
A HeaderPattern parameter
value to use for Web Services
Distributed Management
(WSDM) Event Format (WEF).
114 Chapter 8 / Pattern Layouts
WEFFOOTER </ManagementEvents>
A HeaderPattern parameter
value to use for ARM correlators
and WSDM Event Format.
About Pattern Layouts 115
WEFCORRELATORSFOOTER </ManagementEvents>
1 Operating Environment Information for z/OS: When you specify %uuid or WEF in a logging facility configuration file, the
identifiers that SAS creates are unique only for the current computer node. %uuid or WEF does not create a UUID. You
can obtain a computer node name by using the %S{ hostname}conversion character.
116 Chapter 8 / Pattern Layouts
Dictionary
Syntax
XML Configuration
<appender class="AppenderName" name="appender-reference-name">
<layout>
<param name="Header" value="header-text"/>
<param name="HeaderPattern" value="conversion-pattern"/>
<param name="ConversionPattern" value="conversion-pattern"/>
<param name="Footer" value="footer-text"/>
<param name="FooterPattern" value="conversion-pattern"/>
<param name="XmlEscape" value="TRUE | FALSE"/>
</layout>
</appender>
Syntax Description
class= "AppenderName "name="appender-reference-name"
specifies the name of the appender reference that is to be used as an appender-
ref for a logger.
See For appender class names, see “Appender Reference” on page 45.
name="Header" value="header-text"
specifies the header text that the appender uses when it starts a new log.
Valid in XML configuration files for the File, RollingFile, and Console appender
classes.
name="HeaderPattern" value="conversion-pattern"
specifies the pattern layout that is used to identify, order, and format information
in a header. A conversion pattern consists of optional literal text and optional
format-control directives, which are called conversion specifiers. Each
conversion specifier begins with a percent sign (%) and is followed by optional
format modifiers and one or more instances of the S conversion character or the
d conversion character. The format modifiers control field width, padding, and left
and right justification.
Here is the syntax for a header pattern:
Syntax for a Pattern Layout 117
Valid in XML configuration files for the File, RollingFile, and Console appender
classes.
Restriction The header pattern is limited to the S conversion character and the d
conversion character in a logging configuration file.
Interaction The Header parameter header-text takes precedence over the HeaderPattern
conversion-pattern parameter.
There is no explicit separator between literal text and the conversion specifier.
The pattern parser recognizes the end of a conversion specifier when it
detects the S conversion character or the d conversion character.
name="ConversionPattern" value="conversion-pattern"
specifies the pattern layout that is used to identify, order, and format information
in the log event. A conversion pattern consists of literal text and format-control
directives called conversion specifiers. Each conversion specifier begins with a
percent sign (%) and is followed by optional format modifiers and a conversion
character. The conversion character specifies the type of data (for example,
category, priority, date, and thread name). The format modifiers control field
width, padding, and left and right justification.
Here is the syntax for a conversion pattern:
[literal-text] %[format-modifier-1] conversion-character-1
[… [literal-text] %[format-modifier-n] conversion-character-n] />
name="Footer" value="footer-text"
specifies the footer text that the appender uses when it ends a log.
Valid in XML configuration files for the File, RollingFile, and Console appender
classes.
name="FooterPattern" value="conversion-pattern"
specifies the pattern layout that is used to identify, order, and format information
in a footer. A conversion pattern consists of optional literal text and optional
format-control directives, which are called conversion specifiers. Each
conversion specifier begins with a percent sign (%) and is followed by optional
format modifiers and one or more instances of the S conversion character or the
d conversion character. The format modifiers control field width, padding, and left
and right justification.
Here is the syntax for a footer pattern:
Valid in XML configuration files for the File, RollingFile, and Console
appender classes.
name="XmlEscape" |
specifies whether certain characters that can be specified in the m, x, X, and S
conversion specifiers are converted to their entity representations.
TRUE
specifies that the following characters are converted when they are used in
the m, x, X, and S conversion specifiers:
n "<" is converted to "<"
FALSE
specifies that no character conversion to entity representations is performed.
Here is an explanation:
Pattern
Layout Explanation Example
%c{2} reports the name of the logger that The full logger name is
generated the log event. The Log4SAS.Appender.IOMCall
precision specifier limits the logger Context. The formatted
name to two subfields, causing left- output is
truncation. Appender.IOMCallContext;.
120 Chapter 8 / Pattern Layouts
Pattern
Layout Explanation Example
c Conversion Character
Reports the name of the logger that generates the log event.
Alias: logger
Default: Complete logger name; for example, "Logging.Appender.IOMCallContext".
Syntax
c [ {precision-specifier} ]
Optional Argument
precision-specifier
specifies a decimal constant to indicate the number of logger levels to display in
the message. If you specify precision-specifier, only the corresponding number
of right-most components of the logger name are included in the output.
Example
For the logger name "Logging.Appender.IOMCallContext", the pattern %c{2}
generates this output:
"Appender.IOMCallContext"
d Conversion Character 121
d Conversion Character
Reports the date of the log event.
Alias: date
Defaults: For the ConversionPattern parameter, the ISO8601 format, which is represented as
yyyy-MM-dd HH:mm:ss,SSS.
For the FileNamePattern parameter, yyyy-MM-dd.
Requirement: If the date conversion specifier is used, it must be enclosed in a pair of braces.
Tip: The d conversion character formats three digits for the precision of milliseconds,
regardless of the number of S simple date format characters that are specified, and
regardless of the machine precision of the timing that is available.
Syntax
d [ {date-conversion-specifier} ]
Optional Argument
date-conversion-specifier
specifies the format of the date. Here are the supported date conversion
specifiers:
ABSOLUTE
specifies the time in the format HH:mm:ss,SSS.
Example 15:49:37,459
DATE
specifies the date and time in the format dd MMM yyyy HH:mm:ss,SSS.
ISO8601
specifies the date and time in the format yyyy-MM-dd HH:mm:ss,SSS.
aa: a.m. or p.m. marker (string) FF: Day of week in month (numeric)
hh: Hour in a.m. or p.m. (numeric 1-12) HH: Hour in day (numeric 0-23)
mm: Minute in hour (numeric) KK: Hour in a.m. or p.m. (numeric 0-11)
122 Chapter 8 / Pattern Layouts
EE: Day in week (abbreviated string) 'literal string within single quotation
marks '
Example
Here are examples of the d conversion character:
d{ABSOLUTE}
d{EEEE MMMM yyyy HH:mm:ss,SSS 'Ship date'}
E Conversion Character
Reports library access audit information.
Syntax
E{key}
Optional Arguments
key can be one of the following:
Audit.Dataset.Action
reports the action that is being logged (OPEN, DELETE, or RENAME).
Audit.Dataset.Libref
reports the libref that was used to access the library.
Audit.Dataset.Engine
reports the engine that is associated with the library.
Audit.Dataset.Member
reports the name of the data set member.
Audit.Dataset.Memtype
reports the type of data set member.
Audit.Dataset.NewMember
reports the new name of the renamed data set member.
E Conversion Character 123
Audit.Dataset.Openmode
reports whether the data set is open in READ, WRITE, or UPDATE mode.
Audit.Dataset.Path
reports the path to the library.
Audit.Dataset.Status
reports the status of opening a data set. Valid values are SUCCESS or FAILED.
Audit.Dataset.Sysmsg
reports the message (if any) that is associated with the return code.
Audit.Dataset.Sysrc
reports the numeric return code from the action.
Audit.MetaBoundLib.Action
reports the action that the user is attempting to perform on data that is bound to
the metadata-bound library.
Audit.MetaBoundLib.DataSetInfo.SecuredLibrary
reports the secured library object’s metadata path as it is recorded in the location
information in the SAS data set.
Audit.MetaBoundLib.DataSetInfo.SecuredLibraryGuid
reports the secured library object’s global unique identifier (GUID) as it is
recorded in the location information in the SAS data set.
Audit.MetaBoundLib.DataSetInfo.SecuredTableGuid
reports the GUID for the secured table object.
Audit.MetaBoundLib.DataSetInfo.SecuredTableName
reports the name of the secured table object.
Audit.MetaBoundLib.DataSet.MemberName
reports the member name.
Audit.MetaBoundLib.DataSet.MemberType
reports the member type.
Audit.MetaBoundLib.LibraryInfo.SecuredLibrary
reports the secured library object’s metadata path as it is recorded in the location
information in the physical library.
Audit.MetaBoundLib.LibraryInfo.SecuredLibraryGuid
reports the metadata-bound library’s GUID as it is recorded in the location
information in the physical library.
Audit.MetaBoundLib.Library.Path
reports the physical path for the metadata-bound library.
Audit.MetaBoundLib.Library.Reference
reports the libref for the metadata-bound library.
Audit.MetaBoundLib.RequiredPermission
reports the required permission for the action that the user is attempting to
perform.
Audit.MetaBoundLib.StepName
reports the step name that attempted to access the metadata-bound data.
Audit.MetaBoundLib.User.EffectivePermissions
reports the user’s effective permissions for the metadata-bound data.
Audit.MetaBoundLib.User.IdentityName
reports the user’s metadata identity name.
124 Chapter 8 / Pattern Layouts
Audit.MetaBoundLib.User.LoginId
reports the user’s login ID.
Example
Here is an example of the E conversion character:
libref=%E{Audit.Dataset.Libref}
See Also
n Appendix 1, “Audit Messages for SAS Library Access,” on page 205
n Appendix 2, “Audit Messages for Metadata-Bound Libraries,” on page 211
F Conversion Character
Reports the name of the file in the application that generated the log event.
Alias: file
Syntax
F
K Conversion Character
Retrieves a message key for any appender / layout combination that is generated in the log event.
Alias: messageKey
Default: None
Note: A message key is a language-neutral, unique, search message identifier as defined in
the logging event model specification.
Tip: If no key is associated with a specific log event, this specifier returns an empty string.
Syntax
K
L Conversion Character
Reports the line number in the application that generated the log event.
Alias: line
n Conversion Character 125
Syntax
L
m Conversion Character
Writes the messages that are associated with the log event.
Alias: message
Default: None
Requirement: If the prefix identifier is used, it must be enclosed in a pair of braces.
Syntax
m [ {prefix-identifier} ]
Required Argument
prefix-identifier
specifies an optional identifier to precede all lines after the first line. The
following are valid values for prefix-identifier:
Details
When the message is more than one line long, all lines are written. When a prefix
identifier is specified, all lines after the first line are preceded by the prefix identifier.
n Conversion Character
Enables you to supply discretionary newline characters among the data items that compose the log event.
Default: None
Requirement: If the prefix identifier is used, it must be enclosed in a pair of braces.
Syntax
n [ {newline-prefix-identifier} ]
Optional Argument
newline-prefix-identifier
specifies an optional newline identifier. The following are valid values for
newline-prefix-identifier:
126 Chapter 8 / Pattern Layouts
p Conversion Character
Reports the level of the log event.
Alias: level
Syntax
p
Details
Here are the supported levels:
n TRACE
n DEBUG
n INFO
n WARN
n ERROR
n FATAL
r Conversion Character
Reports the number of milliseconds that elapsed between the start of the application and the creation of
the log event.
Alias: relative
Syntax
r
Syntax
severity{key}
Required Arguments
key can be one of the following:
CBE
reports a CBE severity code. The following table correlates levels with CBE
severity codes:
FATAL 60
ERROR 50
WARN 30
INFO 10
DEBUG 5
TRACE 0
WEF
reports a WEF severity code. The following table correlates levels with WEF
severity codes:
FATAL 6
ERROR 4
WARN 2
INFO 1
DEBUG 0
TRACE 0
WEF has two additional codes that do not correlate to the logging facility levels:
n 5 is a critical condition.
S Conversion Character
Delivers various system information to the log event.
Alias: systemInfo
Requirements: The S conversion character must be followed by the specified value, which is also
referred to as a key, and must be enclosed in a pair of braces.
If you specify a default value, you must specify key and default, separated by “ | “ (the
vertical bar), enclosed in a pair of braces.
Syntax
S {key}
S {key | default}
Required Arguments
default
specifies the value that is used when the information that is specified by key
cannot be found. The value of default is a character string that appears between
| (the vertical bar) and }( the closing bracket).
Note If the character string contains quotation marks, the quotation marks
become part of the value of default. Quotation marks in an XML
attribute must be specified using the character entity ".
Example %S{App.Log|Spawner.log}
key
key can be one of the following types of information:
App.Log
reports the filename that is specified by the LOG= system option when SAS
starts. Otherwise, these actions occur:
n If the LOG= system option does not specify a filename, but a filename is
specified by the SYSIN= system option, the filename that is specified by
the SYSIN= option is used. The file extension is changed to .log.
n If the filename that is specified by the SYSIN= system option lacks a full
pathname, the path of the current working directory is prepended to the
filename.
App.Name
reports the value of the LOGAPPLNAME= system option.
App.Sysin
reports the filename that is specified by the SYSIN= system option.
model_name
reports the name of the manufacturer of the computer hardware. Examples
are HP, SUN, and IBM.
S Conversion Character 129
model_num
reports the model number of the computer hardware. Examples are Itanium,
X86, RS/6000, SPARC, and 9000/800.
host_name
hostname
reports the node name that is assigned to the computer hardware. An
example is apex.com.
serial
reports the serial number of the operating system.
os_name
reports the name of the operating system. Examples are LINUX, HP-UX,
SUNOS, and XP_HOME.
os_version
reports the version of the operating system.
os_release
reports the release number of the operating system. Examples are Linux2.6,
Linux 5, Linux 9, and Linux 11.22.
os_family
reports the family of operating system. Examples are LINUX ITANIUM,
LINUX, SUN 64, HP IPF, and WIN.
jobid
pid
reports the job ID or the process ID, as appropriate.
user_name
username
reports the user name in the appropriate form.
Note The user_name is the identity that owns the process rather than the
client identity that is associated with the current thread.
startup_cmd
reports the arguments that are specified when the application was started.
version
reports either of these versions: TK_BASE_MAJOR or TK_BASE_MINOR.
system_desc
reports a description of the hardware and software environment. Examples
are X86_64 Linux, HP Itanium Processor Family, and Sun Sparc 64-bit.
build_date
reports the date on which the kernel for threaded processing was built.
build_time
reports the time at which the kernel for threaded processing was built.
sup_ver
reports the version number of the SAS supervisor.
sup_ver_long2
reports the version number of the SAS supervisor that is Y2K compliant.
130 Chapter 8 / Pattern Layouts
Example
Here is an example of the S conversion character:
%S{os_family}
sn Conversion Character
Reports the sequence number of the log event.
Alias: sequenceNumber
Syntax
sn
t Conversion Character
Reports the identifier of the thread that generated the log event.
Alias: thread
Syntax
t
u Conversion Character
Reports the client identity that is associated with the current thread or task.
Alias: username
See: “user_name|username ” on page 129 in the S conversion character.
Syntax
u
Details
If the current thread or task does not have an associated identity, the identity that
owns the current process is reported to the log event.
X Conversion Character 131
Syntax
uuid
x Conversion Character
Reports the NDC (nested diagnostic context) that is associated with the thread that generated the log
event.
Alias: ndc
Syntax
x
X Conversion Character
Reports the MDC (mapped diagnostic context) that is associated with the thread that generated the log
event.
Alias: properties
Requirements: The key must be enclosed in a pair of braces.
If you specify a default value, you must specify key and default, separated by “ | “ (the
vertical bar), enclosed in a pair of braces.
Syntax
X {key}
X {key | default}
Required Arguments
default
specifies the value that is used when the information that is specified by key
cannot be found. The value of default is a character string that appears between
| (the vertical bar) and }( the closing bracket).
132 Chapter 8 / Pattern Layouts
Note If the character string contains quotation marks, the quotation marks
become part of the value of default. Quotation marks in an XML
attribute must be specified using the character entity ".
Example %X{clientNumber}|clientNumberNotFound}
key
specifies a parameter that is used to identify the portion of the log to retrieve
using MDC. The values for key are specific for an application or subsystem.
Refer to the application or subsystem documentation for values for key.
Here are some common values for key:
Details
MDC is used to distinguish interleaved log output from different sources. Log output
is typically interleaved when a server manages multiple clients in parallel. The MDC
is managed on a per-thread basis.
The X conversion character must be followed by the key for the map. The value in
the MDC that corresponds to the key is reported.
Example
Here is an example of the X conversion character:
%X{clientNumber}, where clientNumber is the key.
%% Conversion Character
Enables you to specify a literal percent sign symbol in a text string of a conversion pattern.
Syntax
%%
Details
A single percent sign is interpreted as a conversion specifier. Two percent signs are
interpreted as literal text, which is delivered as a single percent sign in the log event.
Format Modifiers 133
Example
Here is an example of the %% conversion character:
<param name="ConversionPattern" value="%d;text%%text;%m"/>
Here is sample output:
2011–06–25–10:24:22,234; text%text;Numeric maximum was larger than 8, am
setting to 8
Format Modifiers
Controls the field width, padding, and justification of the specified data item in log output.
Syntax
- (hyphen)
minimum-field-width-modifier
maximum-field-width-modifier
Examples %-p
minimum-field-width-modifier
specifies a decimal constant to indicate the minimum width of the field for the
data item that is specified by the conversion character. If the data item is smaller
than the minimum field width, the field is padded on either the left or the right
until the minimum width is reached. The padding character is a space. If the data
item exceeds the minimum field width, the field is expanded to accommodate the
data item.
Examples %10p
The constant value, 10, provides a minimum width for the data item
that is specified by the p conversion character. For example, the text
of the level, "WARN", is left-justified and is padded to the right with six
spaces.
maximum-field-width-modifier
specifies a period (.) and a decimal constant to indicate the maximum width of
the field for the data item that is specified by the conversion character.
134 Chapter 8 / Pattern Layouts
Default If the data item exceeds the maximum field width, characters are left-
truncated rather than right-truncated.
Examples %.3p is the pattern layout. "DEBUG" is the data item. "BUG" is the
generated output.
The constant value, 3, provides a maximum width for the data item
that is specified by the p conversion character. For example, the text
of the level, "DEBUG" is left-truncated to form "BUG".
Example
Here are examples of format modifiers that are used with the c conversion
character. The c conversion character reports the name of the logger.
9
Filters
Overview of Filters
When the logging facility filters log events by threshholds, it uses logger and
appender configurations. You can also use filter classes to filter log events, based
on character strings and thresholds:
DenyAllFilter denies log events that did not meet the criteria of
previous filters in a filter policy.
By using filter classes to filter messages, you can choose whether to accept or deny
a log event if a match occurs between a filter parameter and the string or threshold
in the log event.
You configure filter classes by using the <filter> subelements within an appender
configuration.
Filters are processed in the order in which they appear in the appender definition,
creating a filtering policy for the appender.
The results of filtering depend on filter arguments. The AcceptOnMatch argument in
the RepeatMatchFilter, StringMatchFilter, LevelMatchFilter, and LevelRangeFilter
filters indicate whether to accept the log event if there is a match. The following lists
describe the process of deciding whether a log event is accepted or denied:
n RepeatMatchFilter
o If the immediate previous message (%m) is the same as the message (%m)
specified in the log event and if AcceptOnMatch is TRUE, then the appender
processes the log event.
o If the previous message (%m) is the same as the message (%m) specified in
the log event and if AcceptOnMatch is FALSE, then the appender denies the
log event.
n StringMatchFilter and LevelMatchFilter
o If there is a match between the filter string or the filter threshold (level) and
the log event, and if AcceptOnMatch is TRUE, then the appender processes
the log event.
o If there is a match between the filter string or the filter threshold (level) and
the log event, and if AcceptOnMatch is FALSE, then the appender denies the
log event.
o If there is no match between the filter and the log event, then the appender
processes the next filter in the filtering policy. If the log event has not been
denied and if there are no other filters in the filtering policy, then the appender
processes the log event.
n LevelRangeFilter
o If there is a match between the minimum and maximum thresholds (inclusive)
in the filter and the log event, and if AcceptOnMatch is TRUE, the appender
processes the log event.
o If there is no match, the appender denies the log event.
o If there is a match between the minimum and maximum thresholds (inclusive)
in the filter and the log event, and if AcceptOnMatch is FALSE, then the
appender processes the next filter in the filtering policy. If the log event has
not been denied and if there are no other filters in the filtering policy, the
appender accepts and processes the log event.
n AndFilter uses StringMatchFilter, LevelMatchFilter, and LevelRangeFilter as
arguments. The results of these filters as arguments to the AndFilter class is the
same as it is in the individual filters.
Filter Examples 137
You can include DenyAllFilter as the last filter in the filtering policy to deny any log
events that do not meet the filtering policy for the appender.
The following example is a simple filtering policy to log only performance messages
for the ARM subsystem:
<filter class="StringMatchFilter">
<param name="StringToMatch" value="Perf.ARM"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
<filter class="DenyAllFilter">
</filter>
Note: Filter definitions are not available in the logging facility language elements for
SAS programs.
Filter Examples
</filter>
</appender>
<root>
<level value="trace"/>
<appender-ref ref="eventLog"/>
</root>
</logging:configuration>
Dictionary
Syntax
XML Configuration
<appender class="AppenderName" name="log-name">
<filter class="filter-class">
<param name="filter-parameter-1" value="parameter-value-1"/>
<param name="filter-paramter-n" value="parameter-value"/>
</filter>
</appender>
AndFilter
Use AndFilter when you want to log messages that meet multiple criteria.
AndFilter 139
Syntax
<filter class="AndFilter">
<param name="AcceptOnMatch" value="TRUE | FALSE">
<filter class="filter-name">
<param name="filter-parameter" value="filter-parameter-value"/>
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter/>-1
[… <filter class="filter-name">
<param name="filter-parameter-name" value="filter-parameter-value"/>
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter/>-n ]
</filter>
Syntax Description
class="AndFilter"
specifies to apply the AND logical operation on the subfilter results to determine
whether the log event is accepted by the appender.
name="AcceptOnMatch" |
for AndFilter, specifies whether to accept or deny the log event if the result of the
logical AND is TRUE. For subfilter definitions, specifies whether to accept or
deny the log event if the threshold or string matches. Valid values are TRUE or
FALSE.
TRUE
specifies to accept the log event.
FALSE
for AndFilter, StringMatchFilter, and LevelMatchFilter, specifies to deny the
log event.
class="filter-name"
specifies the name of a filter to use as an argument to the AND logical operation.
Here is a list of valid filters:
n AndFilter
n LevelMatchFilter
n LevelRangeFilter
n StringMatchFilter
name="filter-parameter-name" value="filter-parameter-value"
specifies the name of a filter parameter and the parameter value that is used to
compare with either the log event threshold or the message. The following table
shows the filter parameters:
Details
AndFilter syntax allows for two or more subfilter definitions within the AndFilter
definition. The subfilters are evaluated to decide whether to accept or deny the log
event. AndFilters performs a logical AND operation, using the results of each
subfilter evaluation to determine the results of AndFilter.
An example of using AndFilter might be that you want to filter log messages that
have a threshold of INFO and that contain the string "New client connection".
You can filter by a single threshold, a range of thresholds, or by string matching.
Example
The following filter accepts log events that have a threshold of INFO and the string
RETURN in the following log message:
<filter class="AndFilter">
<param name="AcceptOnMatch" value="true"/>
<filter class="LevelMatchFilter">
<param name="LevelToMatch" value="info"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
<filter class="StringMatchFilter">
<param name="StringToMatch" value="RETURN"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
</filter>
<filter class="DenyAllFilter">
</filter>
DenyAllFilter
DenyAllFilter can be configured as the last filter in a chain of filters to deny all messages that do not meet
the filter specifications in the filter chain.
Syntax
<filter class="DenyAllFilter">
LevelMatchFilter 141
Syntax Description
class="DenyAllFilter"
specifies to deny all messages that do not meet the filter chain criteria.
LevelMatchFilter
Use LevelMatchFilter when you want to filter log events for a single message threshold. For example, you
might want to log only error messages, or you might want all messages that do not have a threshold of
FATAL.
Syntax
<filter class="LevelMatchFilter">
<param name="LevelToMatch" value="DEBUG | TRACE | INFO | WARN |
ERROR | FATAL"/>
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter>
Syntax Description
class="LevelMatchFilter"
specifies to filter messages based on a log event threshold.
name="AcceptOnMatch" |
specifies whether to accept or deny the log event if the log event threshold
matches the value in this filter. Valid values are TRUE or FALSE:
TRUE
specifies to accept the log event.
FALSE
specifies to deny the log event.
name="LevelToMatch" | | | | |
specifies the threshold to filter log events for this appender. Valid values are
DEBUG, TRACE, INFO, WARN, ERROR, or FATAL.
Details
To use this filter, you specify a threshold, and you specify whether to accept or deny
the log event if the filter threshold matches the log event threshold. If there is no
match, the filtering process continues with the next filter in the filtering policy. If there
are no other filters in the filtering policy and if the log event has not been denied, the
appender accepts and processes the log event.
142 Chapter 9 / Filters
Example
The following filter denies log events whose threshold is INFO:
<filter class="LevelMatchFilter">
<param name="LevelToMatch" value="info"/>
<param name="AcceptOnMatch" value="false"/>
</filter>
LevelRangeFilter
Use LevelRangeFilter when you want to filter log event messages whose message threshold falls within a
range of message thresholds.
Syntax
<filter class="LevelRangeFilter">
<param name="LevelMax" value="threshold"/>
<param name="LevelMin" value="threshold"/>
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter>
Syntax Description
class="LevelRangeFilter"
specifies to use the LevelRangeFilter
name="LevelMax" value="threshold"
specifies the highest threshold that can be written to the appender.
name="LevelMin" value="threshold"
specifies the lowest threshold that can be written to the appender.
name="AcceptOnMatch" |
specifies whether to accept the log event when the log event message threshold
falls within the threshold range that is specified by the filter. Valid values are
TRUE or FALSE:
TRUE
specifies to accept the log event.
FALSE
specifies to pass the filtering process to the next filter in the filtering policy. If
the log event has not been denied and there are no other filters in the filtering
policy, the appender accepts and processes the log event.
Details
The thresholds are, from lowest to highest: TRACE, DEBUG, INFO, WARN,
ERROR, and FATAL. For example, if the minimum threshold is DEBUG and the
maximum threshold is ERROR, and if AcceptOnMatch is FALSE, messages that
have the thresholds TRACE and FATAL are denied.
RepeatMatchFilter 143
To use this filter, you specify a minimum and a maximum threshold range to
compare with the log event threshold. If there is no match, the log event is denied. If
there is a match and if AcceptOnMatch is TRUE, the appender accepts and
processes the log event. If there is a match and AcceptOnMatch is FALSE, the next
filter in the filtering policy is processed. If there are no other filters in the filtering
policy and if the log event has not been denied, the appender accepts and
processes the log event.
Example
The following filter accepts log events only if the log event threshold is between
WARN and ERROR:
<filter class="LevelRangeFilter">
<param name="LevelMax" value="error"/>
<param name="LevelMin" value="warn"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
RepeatMatchFilter
Use RepeatMatchFilter to discard a message if the message has already been logged by the appender.
Syntax
<filter class="RepeatMatchFilter">
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter>
Syntax Description
name="AcceptOnMatch" |
specifies whether to accept or deny the log event when the log event message is
identical to the last message processed by the appender. Valid values are TRUE
or FALSE:
TRUE
specifies to accept the log event.
FALSE
specifies to deny the log event.
Details
This filter compares only the last message that was processed by this appender with
the current log event message.
As a best practice, you can use this filter as the first filter in appender filtering
policies to discard repeated messages.
144 Chapter 9 / Filters
Example
The following filter definition does not accept log events if a log event message has
already been logged by this appender:
<filter class="RepeatMatchFilter">
<param name="AcceptOnMatch" value="FALSE"/>
</filter>
StringMatchFilter
Use StringMatchFilter when you want to filter messages based on a string in the log event message.
Syntax
<filter class="StringMatchFilter">
<param name="StringToMatch" value="character-string"/>
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter>
Syntax Description
name="StringToMatch" value="character-string"
specifies the string to search for in the log event message.
name="AcceptOnMatch" |
specifies whether to accept or deny the log event when the log event message
contains character-string. Valid values are TRUE or FALSE:
TRUE
specifies to accept the log event.
FALSE
specifies to deny the log event.
Details
To use this filter, you specify a character string, and you specify whether to accept or
deny the log event if the filter character string matches a character string in the log
event message. If there is no match, the filtering process continues with the next
filter in the filtering policy. If there are no other filters in the filtering policy and if the
log event has not been denied, the appender accepts and processes the log event.
Performing string matches on every message requires significant resources. To
avoid performance issues, consider limiting the number of messages that are
processed by this filter. For example, filter only those messages that are associated
with a particular logger or a particular logging level.
Example
The following filter definition does not accept log events that contain the string
"RETURN":
StringMatchFilter 145
<filter class="StringMatchFilter">
<param name="StringToMatch" value="RETURN"/>
<param name="AcceptOnMatch" value="false"/>
</filter>
146 Chapter 9 / Filters
147
PART 3
Chapter 10
The SAS Logging Facility in the SAS Language . . . . . . . . . . . . . . . . . . . . . 149
Chapter 11
Autocall Macro Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Chapter 12
Function Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Chapter 13
Component Object Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
148
149
10
The SAS Logging Facility in the
SAS Language
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. They are also written 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” on page 9 and “LOGCONFIGLOC= System Option” on
page 28.
LOGCONFIGLOC= system option names a logging configuration file. You can check
either by issuing the OPTIONS procedure or by viewing the LOGCONFIGLOC=
system option in the SAS System Options window.
For more information, see “LOGCONFIGLOC= System Option” on page 28 and
“SAS Server Logger Names” on page 10.
Creating Appenders
You create appenders in your SAS program or in the logging configuration file
before you define loggers or before you 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.
Although appenders can be created at any time in a SAS program, appender names
must be unique within a DATA step. Creating the same appender in each iteration of
the implicit loop can result in a DATA step error. To avoid the error, use an IF-THEN
statement to create an appender in only the first iteration of the implicit loop:
if _n_ = 1 then
do;
rc=log4sas_appender("myAppenderName", "FileRefAppender", "fileref=myfile");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
When you create an appender, you specify the appender name, the keyword
FileRefAppender, and appender options. You use appender options to specify a
fileref that references a log file, a conversion pattern to format the message, and the
appender message threshold. The appender THRESHOLD argument enables
appender-level log event message filtering at the appender level. The filtering
occurs after the logging facility processes logger-level message filtering.
The appender name is case sensitive. Be sure to specify the appender name
exactly as it is specified in the respective appender syntax.
An appender that is created by using an autocall macro is defined to SAS for the
duration of the SAS program. An appender that is created in a DATA step exists
only for the duration of the DATA step. After the DATA step or SAS program is
complete, appenders that are created in a DATA step are no longer defined to SAS.
For details, see the following language elements that create appenders in the SAS
language:
n “%LOG4SAS_APPENDER Autocall Macro” on page 162
When you create a logger, you specify the logger name and optional arguments for
the message threshold and for one or more appender references. The logger name
is case sensitive and can be a one-level or multiple-level name. The LEVEL
argument specifies the message threshold that the logger processes. The logger-
level threshold is the first level of message filtering. If a log event threshold is the
same or greater than the logger threshold, the logger accepts the log event and the
Creating Loggers in a SAS Program 153
logging facility uses the appender arguments to process the log event. The
thresholds, from lowest to highest, are TRACE, DEBUG, INFO, WARN, ERROR,
and FATAL. Loggers can be associated with one or more appenders by specifying
appender names in the APPENDER-REF argument. You separate appender names
with a space and enclose the appender names in parentheses.
A logger is defined for the duration of the SAS session. For information about
loggers, see the following topics:
n “Loggers” on page 8
Note: If the logger IMMUTABILITY attribute is set to TRUE, you cannot change the
additivity setting or the level setting using the SAS language, and you cannot
reference an appender in a logger using the SAS language.
Because the logger IT specifies the level as INFO, when a log event specifies the
IT.Pgm1 or IT.Pgm2 logger, the logger level INFO is compared to the log event
message level. The logger definitions in this scenario might look like the following
functions:
/* Create the context for logging regression messages. */
/* Regression log events of level info or higher are written * /
/* to the destination, specified by the appender to be defined as ITPgmRegression. */
if _n_=1 then
do;
rc=log4sas_logger("IT", "appender-ref=(ITPgmRegression) level=info");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
if _n_=1 then
do;
rc=log4sas_logger("IT.Pgm1", "appender-ref=(ITPgm1Regression)");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
if _n_=1 then
do;
rc=log4sas_logger("IT.Pgm2", "appender-ref=(ITPgm2Regression)");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
point 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.
The logger that you specify in the log event names the message category for the
message. It can be a category that you created in your SAS program or a category
that is defined for SAS servers. The diagnostic level indicates one of the following
diagnostic types for the message: TRACE, DEBUG, INFO, WARN, ERROR, and
FATAL. The log message is the message that you want to appear in the log.
Enclose the message in single or double quotation marks.
For more information, see the following topics:
n “Loggers” on page 8
if _n_ = 1 then
do;
rc=log4sas_appender("myPgmRegression", "FileRefAppender", "fileref=myPgmReg");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
156 Chapter 10 / The SAS Logging Facility in the SAS Language
if _n_ = 1 then
do;
rc=log4sas_appender("myPgmNewFunction", "FileRefAppender", "fileref=myPgmNew");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
if _n_=1 then
do;
rc=log4sas_logger("regression", "appender-ref=(myPgmRegression) level=info");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
if _n_=1 then
do;
rc=log4sas_logger("newFunction", "appender-ref=(myPgmNewFunction) level=debug");
if rc ne 0 then do
msg = sysmsg();
put msg;
ABORT;
end;
end;
157
11
Autocall Macro Reference
%LOG4SAS_INFO
is the log event that you use to write informational messages.
%LOG4SAS_ERROR
is the log event that you use to write error messages.
%LOG4SAS_FATAL
is the log event that you use to write fatal messages.
In order to use the logging facility autocall macros, you must set the
MAUTOSOURCE system option in order to activate the autocall facility. The
MAUTOSOURCE system option is set by default.
For more information about autocall macros and the MAUTOSOURCE system
option, see SAS Macro Language: Reference.
data one;
input x y z;
datalines;
1 2 3
;
%macro lst(dsn);
%global x;
%let x=;
/* Open the data set */
%let dsid=%sysfunc(open(&dsn));
/* Call the macro and pass the name of the data set to be processed */
%log4sas_debug(macroVar, 'calling lst(one)');
%lst(one)
%put macro variable x = &x
The file that is referenced by fileref REV1 contains these lines of text:
1 %log4sas();
2 %log4sas_appender(dsvar2mvar, "FileRefAppender", 'fileref=rev1');
3 %log4sas_logger(macroVar, 'level=debug appender-ref=dsvar2mvar');
4
5 /* Create sample data */
6
7 data one;
8 input x y;
9 datalines;
11 ;
12
13 %macro lst(dsn);
14 %global x;
15 %let x=;
16 /* Open the data set */
17 %let dsid=%sysfunc(open(&dsn));
18
19 /* Assign the number of variables into the macro variable CNT */
20 %let cnt=%sysfunc(attrn(&dsid,nvars));
21 %put cnt=&cnt;
22 %log4sas_debug(macroVar, 'The number of variables is set in CNT');
23
24 /* Create a macro variable that contains all data set variables */
25 %do i = 1 %to &cnt;
26 %let x=&x%sysfunc(varname(&dsid,&i));
27 %log4sas_debug(macroVar, 'data set variable appended to macro
variable');
28 %end;
29
30 /* Close the data set */
31 %let rc=%sysfunc(close(&dsid));
32 %mend lst;
33 %log4sas_debug(macroVar, 'lst Macro complete');
lst Macro complete
34
35 /* Call the macro and pass the name of the data set to be processed */
36 %log4sas_debug(macroVar, 'calling lst(one)');
calling lst(one)
37 %lst(one)
cnt= 3
The number of variables is set in CNT
data set variable appended to macro variable
data set variable appended to macro variable
data set variable appended to macro variable
38 %put macro variable x = &x
macro variable x = xyz
39
40 %log4sas_debug(macroVar, 'macro lst(one) complete');
macro lst(one) complete
%LOG4SAS Autocall Macro 161
Dictionary
Syntax
%LOG4SAS( )
Details
You invoke the %LOG4SAS autocall macro in order to initialize the logging
environment for SAS programming. To ensure that the logging environment is
initialized when SAS starts, you can invoke the %LOG4SAS autocall macro as
follows:
n in your autoexec file
See Also
n “Example of Using Autocall Macros to Log Messages” on page 158
Syntax
%LOG4SAS_APPENDER(name, "FileRefAppender"
<, '<FILEREF=fileref> <PATTERN="pattern"> <THRESHOLD=threshold>'> )
Syntax Description
name
specifies the name of the appender.
Requirement Appender names that you create using the SAS language must be
unique for a SAS session.
"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.
Requirements Appender classes are case sensitive. In this instance, the class
name must be FileRefAppender.
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.
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 Layouts” on page 107.
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” on page 18.
Example
The following appender definition names the appender debugMyProgram, names a
log message destination using the fileref debugOut, and specifies a pattern that
reports the filename and the line number of 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
n “Example of Using Autocall Macros to Log Messages” on page 158
164 Chapter 11 / Autocall Macro Reference
Syntax
%LOG4SAS_DEBUG(logger-name, message)
Syntax Description
logger-name
specifies the name of the logger to process this log event.
message
specifies the log event message.
Details
The %LOG4SAS_DEBUG autocall macro is a log event for debugging messages. In
order to log messages using this macro, you must previously define loggers and
appenders either in a SAS program or in a logging configuration file.
See Also
n “Example of Using Autocall Macros to Log Messages” on page 158
Syntax
%LOG4SAS_ERROR(logger-name, message)
Syntax Description
logger-name
specifies the name of the logger to process this log event.
message
specifies the log event message.
Details
The %LOG4SAS_ERROR autocall macro is a log event for error messages. In
order to log messages using this macro, you must previously define loggers and
appenders either in a SAS program or in a logging configuration file.
See Also
n “%LOG4SAS Autocall Macro” on page 161
n “%LOG4SAS_APPENDER Autocall Macro” on page 162
n “%LOG4SAS_LOGGER Autocall Macro” on page 168
n “%LOG4SAS_DEBUG Autocall Macro” on page 164
n “%LOG4SAS_TRACE Autocall Macro” on page 170
166 Chapter 11 / Autocall Macro Reference
Syntax
%LOG4SAS_FATAL(logger-name, message)
Syntax Description
logger-name
specifies the name of the logger to process this log event.
message
specifies the log event message.
Details
The %LOG4SAS_FATAL autocall macro is a log event for fatal messages. In order
to log messages using this macro, you must previously define loggers and
appenders either in a SAS program or in a logging configuration file.
See Also
n “%LOG4SAS Autocall Macro” on page 161
n “%LOG4SAS_APPENDER Autocall Macro” on page 162
n “%LOG4SAS_LOGGER Autocall Macro” on page 168
n “%LOG4SAS_DEBUG Autocall Macro” on page 164
n “%LOG4SAS_TRACE Autocall Macro” on page 170
n “%LOG4SAS_WARN Autocall Macro” on page 171
n “%LOG4SAS_INFO Autocall Macro” on page 167
n “%LOG4SAS_ERROR Autocall Macro” on page 165
%LOG4SAS_INFO Autocall Macro 167
Syntax
%LOG4SAS_INFO(logger-name, message)
Syntax Description
logger-name
specifies the name of the logger to process this log event.
message
specifies the log event message.
Details
The %LOG4SAS_INFO autocall macro is a log event for informational messages. In
order to log messages using this macro, you must previously define loggers and
appenders either in a SAS program or in a logging configuration file.
See Also
n “Example of Using Autocall Macros to Log Messages” on page 158
Syntax
%LOG4SAS_LOGGER(name <, "<ADDITIVITY=TRUE | FALSE>
<APPENDER-REF=(appender-list)> <LEVEL=level>">)
Syntax Description
name
specifies the name of the logger.
Tip You can specify the root logger by setting name equal to either two double
quotation marks with no space between them (" "), or to "root".
ADDITIVITY= |
specifies whether to pass log events to only the appender that is associated with
the logger or to all of the appenders in the logger's hierarchy.
APPENDER-REF=(appender-list)
specifies one or more appender names to which log events are passed.
Requirements The appender names must already exist. Appenders are created
by the %LOG4SAS_APPENDER autocall macro or defined in a
logging configuration file.
When you specify more than one appender, the list must be
enclosed in parentheses.
LEVEL=level
specifies the level at which log events of the specified level and higher are
processed by the logger. The following are the valid level values, from lowest to
highest: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
Restriction LEVEL can be modified for a logger only if the logger is defined in a
logging configuration file and if the IMMUTABILITY attribute in the
%LOG4SAS_LOGGER Autocall Macro 169
Details
Logger Names
A logger is an ancestor of another logger if the logger name, followed by a dot, is
the prefix of the other logger.
In the following example, MYPROGRAM is the parent logger. MYPROGRAM is the
ancestor of the UNITTEST logger, and both MYPROGRAM and UNITTEST are
ancestors of the REV1 logger.
MYPROGRAM
MYPROGRAM.UNITTEST
MYPROGRAM.UNITTEST.REV1
The hierarchical organization of loggers enables them to inherit log event levels and
appenders from their ancestors.
Additivity
By default, each log event is passed to the appenders that are referenced by the
logger and to the appenders that are referenced by loggers in the logger's hierarchy.
This is the meaning of the term appender additivity.
For example, by default, when a log event is processed by the logger
MyProgram.UnitTest.Rev1, the log message is also directed to the appenders that
are referenced in the MyProgram.UnitTest and MyProgram loggers. If
ADDITIVITY=FALSE, the log message is directed only to the appenders that are
referenced by MyProgram.UnitTest.Rev1.
Levels
A logging request is applied if its level is greater than or equal to the level of the
logger. Otherwise, the logging request is ignored. Loggers without an explicitly
assigned level inherit their level from the hierarchy. For more information about
logging levels, see “Logging Thresholds” on page 18.
See Also
n “Example of Using Autocall Macros to Log Messages” on page 158
Syntax
%LOG4SAS_TRACE(logger-name, message)
Syntax Description
logger-name
specifies the name of the logger to process this log event.
message
specifies the log event message.
Details
The %LOG4SAS_TRACE autocall macro is a log event for trace messages. In order
to log messages using this macro, you must previously define loggers and
appenders either in a SAS program or in a logging configuration file.
See Also
n “Example of Using Autocall Macros to Log Messages” on page 158
Syntax
%LOG4SAS_WARN(logger-name, message)
Syntax Description
logger-name
specifies the name of the logger to process this log event.
message
specifies the log event message.
Details
The %LOG4SAS_WARN autocall macro is a log event for warning messages. In
order to log messages using this macro, you must previously define loggers and
appenders either in a SAS program or in a logging configuration file.
See Also
n “%LOG4SAS Autocall Macro” on page 161
n “%LOG4SAS_APPENDER Autocall Macro” on page 162
n “%LOG4SAS_LOGGER Autocall Macro” on page 168
n “%LOG4SAS_DEBUG Autocall Macro” on page 164
n “%LOG4SAS_WARN Autocall Macro” on page 171
n “%LOG4SAS_INFO Autocall Macro” on page 167
n “%LOG4SAS_ERROR Autocall Macro” on page 165
n “%LOG4SAS_FATAL Autocall Macro” on page 166
n “Example of Using Autocall Macros to Log Messages” on page 158
172 Chapter 11 / Autocall Macro Reference
173
12
Function Reference
When you create appenders and loggers, remember to create them only once in a
DATA step, as in this example:
if _n_ = 1 then
do;
rc=log4sas_appender("myAppenderName", "FileRefAppender",
"fileref=myfile");
if rc ne 0 then do;
msg = sysmsg();
put msg;
ABORT;
end;
if rc ne 0 then do;
msg = sysmsg();
put msg;
ABORT;
end;
end;
if _n_ = 1 then
do;
rc=log4sas_appender("functionAppender", "FileRefAppender",
"fileref=myfile");
if rc ne 0 then do;
msg = sysmsg();
put msg;
ABORT;
end;
rc=log4sas_logger("functionLogger", "appender-ref=(functionAppender)
level=info");
if rc ne 0 then do;
msg = sysmsg();
put msg;
ABORT;
end;
rc=log4sas_logevent("functionLogger", "info",
"Determined the number of business
days.");
if rc ne 0 then do;
msg = sysmsg();
put msg;
ABORT;
end;
put msg;
ABORT;
end;
end;
datalines;
01/01/1986
02/28/1990
12/03/2006
02/28/2000
02/29/2000
03/01/2000
05/10/1974
05/11/1974
05/12/1974
;
Dictionary
LOG4SAS_APPENDER Function
Creates a fileref appender that can be referenced by a logger.
Category: Logging
Restriction: An appender can be attached to a logger using the SAS language only if the logger
option IMMUTABILITY="FALSE" is set for the logger. Logger immutability can be set
only in an XML configuration file.
Example: “Logging Example Using Functions” on page 174
Syntax
LOG4SAS_APPENDER("name", "FileRefAppender" , <'options'>)
Required Arguments
"name"
specifies a name for the appender.
Requirement Appender names that you create using the SAS language must be
unique for a SAS session.
"FileRefAppender"
specifies that a fileref is used as the destination for the appender.
'options'
specify one or more of the following values:
FILEREF=fileref
specifies a fileref that is used as the log message destination for this
appender.
Requirement Yes
PATTERN="pattern"
specifies one or more message layout patterns that are used to format the
log message.
THRESHOLD=threshold
specifies a level at which log events that are lower than threshold are filtered
out for the appender. Valid values for threshold, from lowest to highest, are
TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
Details
Appender Names
Appender names follow SAS naming conventions. An appender is associated with a
logger by using the appender name as one of the values of the APPENDER-REF
option in the LOG4SAS_LOGGER function.
FileRefAppender
A FileRefAppender is the only type of appender that can be used in the SAS
language.
Patterns
Patterns are a feature of SAS logging that enable 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
Thresholds
An appender can be defined to have a threshold level. By default, appenders do not
have a threshold. 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” on page 18.
See Also
Functions:
n “LOG4SAS_LOGEVENT Function” on page 182
n “LOG4SAS_LOGGER Function” on page 179
LOG4SAS_LOGGER Function
Creates a logger.
Category: Logging
Example: “Logging Example Using Functions” on page 174
Syntax
LOG4SAS_LOGGER("name", <"options"> )
Required Arguments
"name"
specifies a name for the logger.
Tips Requests to create a logger are ignored if they use the name of an
existing logger.
180 Chapter 12 / Function Reference
You can specify the root logger by setting name equal to either two
double quotation marks with no space between them (" "), or to
"root". If you specify the root logger, these settings are in effect
only during the lifespan of the DATA step. Root settings before and
after the DATA step are based on the logging configuration file.
Example App.Security
"options"
specify one or more of the following options for this logger:
ADDITIVITY=( | )
specifies whether to pass a log event to only the appender that is associated
with the logger or to all of the appenders in the logger's hierarchy. TRUE
specifies to send a log event to all of the appenders in the logger's hierarchy.
FALSE specifies to send a log event to only the appenders that are
referenced by the APPENDER-REF= option.
Default TRUE
APPENDER-REF=(appender_name_list)
specifies one or more appender names to which log events for the logger are
passed. Separate the appender names with a space or a comma.
Tip If the value of ADDITIVITY is TRUE, then the log events are
processed by appenders that are found in the logger's
hierarchy.
LEVEL=level
specifies the ranking, or level, of a log event message that the logger
processes. The logger processes log events whose level is the same as or
greater than level. The levels, from the lowest level to the highest level are
TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
Details
Logger Names
The logger name associates a logger with a log message. You can send log
messages to be processed by a logger by specifying the logger name as the name
argument in the LOG4SAS_LOGEVENT function.
A logger is an ancestor of another logger if the logger name, followed by a dot, is
the prefix of the other logger. The following names are logger names:
LOG4SAS_LOGGER Function 181
Testing
Testing.MyProg
Testing.MyProg.TraceMsgs
Testing is the parent logger and the ancestor of the loggers MyProg and TraceMsgs.
MyProg is the ancestor of TraceMsgs. The logger Testing.MyProg.TraceMsgs
provides a message category that can be used to log trace messages when you are
testing the program MyProg.
The hierarchical organization of loggers enables loggers to inherit levels and
appenders from their ancestors. For information about configuring loggers in a
hierarchy, see “Hierarchical Logger Names” on page 9.
Levels
A log event is applied if the level of the log event is the same or greater than the
level of the logger. If the level of the log event is lower than the level of the logger,
then the log event is discarded. For more information about levels, see “Logging
Thresholds” on page 18.
If a logger does not define a level, the logger inherits the level from the next highest
ancestor that has an assigned level.
See Also
Functions:
n “LOG4SAS_APPENDER Function” on page 177
n “LOG4SAS_LOGEVENT Function” on page 182
LOG4SAS_LOGEVENT Function
Logs a message by using a specific logger.
Category: Logging
Example: “Logging Example Using Functions” on page 174
Syntax
LOG4SAS_LOGEVENT("name", "level", "message")
Required Arguments
"name"
specifies a name for the logger that processes the log event.
"level"
specifies one of the following message levels:
"message"
specifies the message that is logged.
Interaction The only variables that the message can resolve are macro
variables. DATA step variables do not resolve in the message.
Details
Name
The log message name argument names a logger to process the log message.
A logger is an ancestor of another logger if the logger name, followed by a dot, is
the prefix of the other logger. The following names are logger names:
Testing
Testing.MyProg
Testing.MyProg.TraceMsgs
Testing is the parent logger and the ancestor of the loggers MyProg and TraceMsgs.
MyProg is the ancestor of the logger TraceMsgs. The logger
Testing.MyProg.TraceMsgs provides a message category that can be used to log
trace messages when you are testing the program MyProg.
The hierarchical organization of loggers enables loggers to inherit levels and
appenders from their ancestors. For information about configuring loggers in a
hierarchy, see “Hierarchical Logger Names” on page 9.
See Also
Functions:
n “LOG4SAS_APPENDER Function” on page 177
n “LOG4SAS_LOGGER Function” on page 179
184 Chapter 12 / Function Reference
185
13
Component Object Reference
Note: The DATA step component object statements, attributes, and methods are
limited to those defined for these objects. You cannot use SAS Component
Language functionality with these predefined DATA step objects.
Definition
Dot notation provides a shortcut for invoking methods and for setting and querying
attribute values. Using dot notation makes your SAS programs easier to read.
To use dot notation with a DATA step component object, you must declare and
instantiate the component object by using the DECLARE statement.
Syntax
object.attribute
or
object.method(<argument_tag-1: value-1<, ...argument_tag-n: value-n>>);
Arguments
object
specifies the variable name for the DATA step component object.
attribute
specifies an object attribute to assign or query.
When you set an attribute for an object, the code takes this form:
object.attribute = value;
When you query an object attribute, the code takes this form:
value = object.attribute;
method
specifies the name of the method to invoke.
argument_tag
identifies the arguments that are passed to the method. Enclose the argument
tag in parentheses. The parentheses are required whether or not the method
contains argument tags.
All DATA step component object methods take this form:
return_code = object.method(<argument_tag-1: value-1
<,...argument_tag-n: value-n>>);
ADDITIVITY Attribute 187
The return code indicates whether the method is successful or failed. A return
code of zero indicates success; a nonzero value indicates failure. If you do not
supply a return code variable for the method call and if the method fails, an error
message is printed to the log.
value
specifies the argument value.
Dictionary
ADDITIVITY Attribute
Specifies whether to pass a log event only to the appender that is associated with the logger or to the
appenders in the logger's hierarchy.
Applies to: logger object
Syntax
object.ADDITIVITY=" | ";
Required Arguments
object
specifies the name of the logger object.
"TRUE | FALSE"
determines whether a log event is processed by the appenders that exist in the
specified logger's hierarchy.
Default TRUE
Details
By default, each log event is passed to the appenders that are associated with the
logger and to the appenders that are associated with the logger's hierarchy. This is
the meaning of the term appender additivity.
For example, by default, when a log event is processed by the logger
Testing.MyProg.TraceMsgs, the log message is also directed to the appenders that
are referenced in the Testing.MyProg and Testing loggers. If ADDITIVITY=FALSE,
the log message is directed to only the appenders that are referenced by
Testing.MyProg.TraceMsgs.
Note: You can also specify the logger additivity in the logger's constructor by using
the DECLARE statement. For more information, see “DECLARE Statement: Logger
Object” on page 193.
188 Chapter 13 / Component Object Reference
Example
The following code sets the additivity attribute to FALSE.
data _null_;
if _n_ = 1 then do;
declare logger logobj("mylog");
end;
logobj.additivity="false";
run;
Alternatively, you can set the additivity attribute in the DECLARE statement.
data _null_;
if _n_ = 1 then do;
declare logger logobj("mylog", additivity:"false");
end;
run;
See Also
Statements:
n “DECLARE Statement: Logger Object” on page 193
APPENDERREF Attribute
Specifies the name of the appender to which log events are passed.
Applies to: logger object
Restriction: An appender can be attached to a logger using the SAS language only if the logger
option IMMUTABILITY="FALSE" is set for the logger. Logger immutability can be set
only in an XML configuration file.
Syntax
object.APPENDERREF="appender-name";
Required Arguments
object
specifies the name of the logger object.
appender-name
specifies the name of the appender to which the log events for the specified
logger are passed.
Requirement Appender names that you create using the SAS language must be
unique for a SAS session.
Interactions If the ADDITIVITY attribute is set to TRUE, the log events are also
passed to all the appenders that are associated with the logger's
hierarchy.
DEBUG Method 189
Details
You can specify more than one appender for each logger.
Example
The logger object in the following example references the myappd appender.
filename myfref "my.log";
data _null_;
if _n_ = 1 then do;
declare appender appobj("myappd", "FileRefAppender", "FileRef=myfref");
declare logger logobj("mylog", level: "info");
logobj.appenderref="myappd";
end;
logobj.additivity="false";
logobj.info("my info message");
run;
See Also
Attributes:
n “ADDITIVITY Attribute” on page 187
Statements:
n “DECLARE Statement: Appender Object” on page 190
DEBUG Method
Logs a DEBUG message if the specified logger accepts DEBUG messages.
Applies to: logger object
Syntax
object.DEBUG("message");
Required Arguments
object
specifies the name of the logger object.
190 Chapter 13 / Component Object Reference
message
specifies the message to write at the debug level.
Details
The debug level designates fine-grained informational events that are most useful to
debug an application. For more information about logging levels, see “Logging
Thresholds” on page 18.
Example
The following example creates a debugging message for the logger.
data _null_;
if _n_=1 then do;
declare appender appobj("myappender","FileRefAppender","fileref=myfile");
declare logger logobj("testlog",AppenderRef:"myappender");
end;
...more-sas-code...
...more-sas-code...
run;
See Also
Methods:
n “ERROR Method” on page 195
n “FATAL Method” on page 196
n “INFO Method” on page 197
n “TRACE Method” on page 199
n “WARN Method” on page 200
Syntax
DECLARE APPENDER appender-object ("appender-name",
"FileRefAppender", "FILEREF =fileref" <, PATTERN: "pattern">
<, THRESHOLD: "threshold">);
Required Arguments
appender-object
specifies the name of the appender object.
appender-name
specifies the name of the appender to which the log events are passed.
FileRefAppender
specifies the FileRefAppender class to which the defined appender instance
belongs.
Requirements Appender class names are case sensitive. In this instance, the
name must be “FileRefAppender”.
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.
THRESHOLD: "threshold"
specifies the level at which log events are filtered out for the specified appender
object. Valid values are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
Details
Appender Names
Appender names follow the rules for SAS naming conventions. For appender
objects, the name can be referenced by the logger object in the APPENDERREF
attribute. For more information, see “APPENDERREF Attribute” on page 188. Here
is an example:
filename myfile "my.log";
declare appender appobj("workappd", "FileRefAppender", "FileRef=myfile");
declare logger logobj("testlog");
logobj.appenderref="workappd";
FileRefAppender
A FileRefAppender is the only type of appender that can be used in the SAS
language.
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 is %m, the message.
For more information, see “Pattern Layouts” on page 107.
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” on page 18.
Example
This example creates an appender object.
data _null_;
if _n_ = 1 then do;
declare appender appobj("testappd", "FileRefAppender", "fileref=testfref",
pattern:"%nrstr(%d{yyyMMdd:HH.mm.ss.SS}: %t:%8p %m)",
threshold:"fatal");
end;
run;
See Also
Attributes:
DECLARE Statement: Logger Object 193
Statements:
n “DECLARE Statement: Logger Object” on page 193
Syntax
DECLARE LOGGER logger-object("logger-name" <, ADDITIVITY: | >
<, LEVEL:"level">
<, APPENDERREF:"appender-name-1" <, APPENDERREF:"appender-name-2"> …
>);
Required Arguments
logger-object
specifies the name of the logger object.
logger-name
specifies the name of the logger to which the specified options are applied.
Tip You can specify the root logger by setting name equal to either
double quotation marks with no space between them (" "), or to
"root". If you specify the root logger, these settings are in effect
only during the lifespan of the DATA step. Root settings before and
after the DATA step are based on the logging configuration file.
ADDITIVITY: |
specifies whether to pass a log event only to the appender that is associated
with the logger or to all the appenders in the logger's hierarchy.
Tip You can also specify this optional argument by using the
ADDITIVITY attribute after the logger instance has been created. For
more information, see “ADDITIVITY Attribute” on page 187.
194 Chapter 13 / Component Object Reference
LEVEL: "level"
specifies the level at which a logging request is applied for the specified logger
object. Valid values are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
Tip You can also specify this optional argument by using the LEVEL
attribute after the logger instance has been created. For more
information, see “LEVEL Attribute” on page 198.
APPENDERREF: "appender-name"
specifies the name of the appender to which log events are passed.
Requirement The appender name must already exist. Appender names are
created by using the DECLARE Statement, Appender Object or
are defined in a logging configuration file.
Interaction If the ADDITIVITY argument is set to TRUE, the log events are
also passed to all the appenders that are associated with the
logger's hierarchy.
Tips You can specify more than one appender for each logger.
Details
Logger Names
A logger instance is said to be an ancestor of another logger instance if the logger
instance name, followed by a dot, is the prefix of the other logger.
In the following example, IOM is the parent logger, IOM is an ancestor of the APP
logger, and both IOM and IOM.APP are ancestors of the WORKSPACE logger.
logobj.name="IOM";
logobj.name="IOM.APP";
logobj.name="IOM.APP.WORKSPACE";
The hierarchical organization of loggers enables them to inherit log event levels and
appenders from their ancestors.
Additivity
By default, each log event is passed to the appenders that are associated with the
logger and to the appenders that are associated with the logger's hierarchy. This is
the meaning of the term appender additivity.
ERROR Method 195
Levels
A logging request is applied if its level is greater than the level of the logger.
Otherwise, the logging request is ignored. Loggers that do not have an explicitly
assigned level inherit their level from the hierarchy. For more information about the
logging levels, see “Logging Thresholds” on page 18.
Example
The following example creates a logger object, logobj.
data _null_;
if _n_ = 1 then do;
declare appender appobj("myappd", "FileRefAppender", "fileref=myfref");
appobj.threshold="trace";
declare logger logobj("mylog");
logobj.appenderref="myappd";
end;
logobj.level="trace";
logobj.debug("Test debug message");
logobj.level="info";
logobj.info("Test info message");
run;
See Also
Attributes:
n “ADDITIVITY Attribute” on page 187
n “APPENDERREF Attribute” on page 188
n “LEVEL Attribute” on page 198
Statements:
n “DECLARE Statement: Appender Object” on page 190
ERROR Method
Logs an ERROR message if the specified logger accepts ERROR messages.
Applies to: logger object
Syntax
object.ERROR("message");
196 Chapter 13 / Component Object Reference
Required Arguments
object
specifies the name of the logger object.
message
specifies the message to write at the error level.
Details
The error level designates error events. The application might be able to continue
running. For more information about the logging levels, see “Logging Thresholds” on
page 18.
Example
The following example creates an error message for the logger.
data _null_;
if _n_ = 1 then do;
declare logger logobj("testlog");
end;
logobj.error("Test error message");
run;
See Also
Methods:
n “DEBUG Method” on page 189
n “FATAL Method” on page 196
n “INFO Method” on page 197
n “TRACE Method” on page 199
n “WARN Method” on page 200
FATAL Method
Logs a FATAL message if the specified logger accepts FATAL messages.
Applies to: logger object
Syntax
object.FATAL("message");
INFO Method 197
Required Arguments
object
specifies the name of the logger object.
message
specifies the message to write at the fatal level.
Details
The fatal level designates very severe error events that might cause the application
to end abruptly. For more information about logging levels, see “Logging
Thresholds” on page 18.
Example
The following example creates a fatal message for the logger.
data _null_;
if _n_ = 1 then do;
declare logger logobj("testlog");
end;
logobj.fatal("Test fatal message");
run;
See Also
Methods:
n “DEBUG Method” on page 189
n “ERROR Method” on page 195
n “INFO Method” on page 197
n “TRACE Method” on page 199
n “WARN Method” on page 200
INFO Method
Logs an INFO message if the specified logger accepts INFO messages.
Applies to: logger object
Syntax
object.INFO("message");
198 Chapter 13 / Component Object Reference
Required Arguments
object
specifies the name of the logger object.
message
specifies the message to write at the info level.
Details
The info level designates informational events that highlight the progress of an
application at a coarse-grained level. For more information about logging levels, see
“Logging Thresholds” on page 18.
Example
The following example creates an info message for the logger.
data _null_;
if _n_ = 1 then do;
declare logger logobj("testlog");
end;
logobj.info("Test info message");
run;
See Also
Methods:
n “DEBUG Method” on page 189
n “ERROR Method” on page 195
n “FATAL Method” on page 196
n “TRACE Method” on page 199
n “WARN Method” on page 200
LEVEL Attribute
Defines the level of message that is accepted by the specified logger.
Applies to: logger object
Syntax
object.LEVEL="level";
TRACE Method 199
Required Arguments
object
specifies the name of the logger object.
level
specifies the level at which a logging request is applied for the specified logger
object. Valid values are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
Details
A logging request is applied if its level is greater than the level of the logger.
Otherwise, the logging request is ignored. Loggers without an explicitly assigned
level inherit their level from the hierarchy. For more information about the logging
levels, see “Logging Thresholds” on page 18.
Note: You can specify the logger level in the logger's constructor by using the
DECLARE statement. For more information, see “DECLARE Statement: Logger
Object” on page 193.
Example
The following code sets the attribute level to trace.
data _null_;
if _n_ = 1 then do;
declare logger logobj("mylog"):
end;
logobj.additivity="false";
logobj.level="trace";
run;
Alternatively, you can set the level attribute in the DECLARE statement constructor.
data _null_;
if _n_ = 1 then do;
declare logger logobj("mylog", additivity:"false", level:"trace");
end;
run;
See Also
Statements:
n “DECLARE Statement: Logger Object” on page 193
TRACE Method
Logs a TRACE message if the specified logger accepts TRACE messages.
Applies to: logger object
200 Chapter 13 / Component Object Reference
Syntax
object.TRACE("message");
Required Arguments
object
specifies the name of the logger object.
message
specifies the message to write at the trace level.
Details
The trace level designates finer-grained informational events then DEBUG. For
more information about logging levels, see “Logging Thresholds” on page 18.
Example
The following example creates a trace message for a logger.
data _null_;
if _n_ = 1 then do;
declare logger logobj("testlog");
end;
logobj.trace("Test trace message");
run;
See Also
Methods:
n “DEBUG Method” on page 189
n “ERROR Method” on page 195
n “FATAL Method” on page 196
n “INFO Method” on page 197
n “WARN Method” on page 200
WARN Method
Logs a WARN message if the specified logger accepts WARN messages.
Applies to: logger object
WARN Method 201
Syntax
object.WARN("message");
Required Arguments
object
specifies the name of the logger object.
message
specifies the message to write at the warn level.
Details
The warn level designates potentially harmful situations. For more information about
logging levels, see “Logging Thresholds” on page 18.
Example
The following example creates a warn message for a logger.
data _null_;
if _n_ = 1 then do;
declare logger logobj("testlog");
end;
logobj.warn("Test warn message");
run;
See Also
Methods:
n “DEBUG Method” on page 189
n “ERROR Method” on page 195
n “FATAL Method” on page 196
n “INFO Method” on page 197
n “TRACE Method” on page 199
202 Chapter 13 / Component Object Reference
203
PART 4
Appendix
Appendix 1
Audit Messages for SAS Library Access . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Appendix 2
Audit Messages for Metadata-Bound Libraries . . . . . . . . . . . . . . . . . . . . . . 211
204
205
Appendix 1
Audit Messages for SAS Library
Access
n the return code from the action and the associated message (if any). Warning
and note messages have a status of SUCCESS and negative return codes. Error
messages have a status of FAILED and positive return codes.
n the libref.
n the mode that the library was opened for: INPUT, OUTPUT, or UPDATE.
Note: Audit messages are not available for in-database tables, filerefs, or SAS
cubes.
Based on the XML configuration files that SAS provides, auditing messages appear
when the logging threshold is TRACE.
To configure the XML configuration file for auditing SAS libraries, you specify a path
and filename for the audit log in the appender fileNamePattern parameter. Then,
specify a conversion pattern in the conversionPattern parameter.
Here is an example audit path and filename:
"SAS-configuration-directory/Lev1/
SAS-application/server-name/Logs/
Audit.Library_server_%d_%S{hostname}_%S{pid}.log"
Sysmsg= %E{Audit.Dataset.Sysmsg}
For a sample logger and appender, see “Sample: XML Logger and Appender” on
page 207.
See Also
“E Conversion Character” on page 122
Here is a sample SAS program that creates an audit report data set from your audit
log data:
/* Specify the directory where your log files are saved. */
%let logdir=your-log-directory;
%macro findfiles(logdir);
data filelist (keep=directory logfile hostname pid);
format directory logfile $512. hostname $80. pid $8.;
directory="&logdir.";
rc=filename("ONE","&logdir.");
if rc ne 0 then do;
msgLine="NOTE: Unable to assign a filename to directory &logdir.";
put msgLine;
end;
else do;
did=dopen("ONE");
if did > 0 then do;
numfiles=dnum(did);
put numfiles=;
do i=1 to numfiles;
logfile=dread(did,i);
hostname=scan(logfile,-3,'_.');
pid=scan(logfile,-2,'_.');
output;
end;
end;
rc=filename("ONE");
did=dclose(did);
end;
run;
%mend;
/* Read through a data set of directory name and filenames and read the audit logs.*/
%macro readfiles(list);
%let dsid = %sysfunc(open(&list));
%if &dsid %then %do;
%syscall set(dsid);
%let nobs =%sysfunc(attrn(&dsid,nlobs));
%do i=1 %to &nobs;
%let rc=%sysfunc(fetch(&dsid));
%let ldir=%sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,DIRECTORY))));
%let lfile=%sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,LOGFILE))));
%let host=%sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,HOSTNAME))));
%let pid=%sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,PID))));
filename auditlog "&ldir.\&lfile.";
data auditlib;
infile auditlog recfm=V lrecl=512 pad missover;
informat DateTime B8601DT23.3; format DateTime datetime23.3;
length Userid $ 80; label Userid='Userid';
length Action $ 16;
length Libref $ 16;
length Engine $ 16;
length Member $ 32;
length NewMember $ 32;
length MemberType $ 16;
210 Appendix 1 / Audit Messages for SAS Library Access
Hostname=trim("&Hostname.");
Pid=trim("&Pid.");
run;
%mend;
%findfiles(&logdir);
%readfiles(filelist);
211
Appendix 2
Audit Messages for Metadata-
Bound Libraries
n Audit.Data.MetaBoundLib.AuthAudit
Auditing messages appear when the logging threshold for these loggers is set to
TRACE.
Audit.MetaBoundLib.Library.Reference
reports the libref for the metadata-bound library
Audit.MetaBoundLib.RequiredPermission
reports the required permission for the action that the user is attempting to
perform
Audit.MetaBoundLib.StepName
reports the step name that attempted to access the metadata-bound data
Audit.MetaBoundLib.User.EffectivePermissions
reports the user’s effective permissions for the metadata-bound data
Audit.MetaBoundLib.User.IdentityName
reports the user’s metadata identity name
Audit.MetaBoundLib.User.LoginId
reports the user’s login ID
For sample appender definitions and logger definitions, see “Sample: XML Loggers
and Appenders” on page 213. For a sample log message, see “Sample: Audit
Message for a Metadata-Bound Library” on page 215.
See Also
<level value="Trace"/>
</logger>
Action=%E{Audit.MetaBoundLib.Action}
LoginId=%E{Audit.MetaBoundLib.User.LoginId}
IdentityName=%E{Audit.MetaBoundLib.User.IdentityName}
Libref=%E{Audit.MetaBoundLib.Library.Reference}
OSLibraryPath=%E{Audit.MetaBoundLib.Library.Path}
MemberName=%E{Audit.MetaBoundLib.DataSet.MemberName}
MemberType=%E{Audit.MetaBoundLib.DataSet.MemberType}
DataSetInfoSecLib=%E{Audit.MetaBoundLib.DataSetInfo.SecuredLibrary}
DataSetInfoSecLibGuid=%E{Audit.MetaBoundLib.DataSetInfo.SecuredLibraryGuid}
DataSetInfoSecTabName=%E{Audit.MetaBoundLib.DataSetInfo.SecuredTableName}
DataSetInfoSecTabGuid=%E{Audit.MetaBoundLib.DataSetInfo.SecuredTableGuid}
LibraryInfoSecLib=%E{Audit.MetaBoundLib.LibraryInfo.SecuredLibrary}
LibraryInfoSecLibGuid=%E{Audit.MetaBoundLib.LibraryInfo.SecuredLibraryGuid}
RequiredPermission=%E{Audit.MetaBoundLib.RequiredPermission}
UserEffectivePermissions=%E{Audit.MetaBoundLib.User.EffectivePermissions}
Message=%m"/>
</layout>
</appender>