Previous Page | Next Page

SAS System Options

LOGPARM= System Option



Specifies when SAS log files are opened, closed, and, in conjunction with the LOG= system option, how they are named.
Valid in: configuration file, SAS invocation
Restriction: LOGPARM= is valid only in line mode and in batch mode
Category: Log and procedure output control: SAS log
PROC OPTIONS GROUP= LOGCONTROL
See: LOGPARM= System Option under OpenVMS z/OS

Syntax
Syntax Description
Details
Examples
See Also

Syntax

LOGPARM=
"<OPEN= APPEND | REPLACE | REPLACEOLD>
<ROLLOVER= AUTO | NONE | SESSION | n | nK | nM | nG>
<WRITE= BUFFERED | IMMEDIATE>"


Syntax Description

OPEN=APPEND | REPLACE | REPLACEOLD

when a log file already exists, specifies how the contents of the existing file are treated.

APPEND

appends the log when opening an existing file. If the file does not already exist, a new file is created.

REPLACE

overwrites the current contents when opening an existing file. If the file does not already exist, a new file is created.

REPLACEOLD

replaces files that are more than one day old. If the file does not already exist, a new file is created.

Operating Environment Information:   For z/OS, see the SAS documentation for your operating environment for limitations on the use of OPEN=REPLACEOLD.  [cautionend]

Default: REPLACE
ROLLOVER=AUTO|NONE|SESSION | n | nG | nM | nG

specifies when or if the SAS log "rolls over". That is, when the current log is closed and a new one is opened.

AUTO

causes an automatic "rollover" of the log when the directives in the value of the LOG= option change, that is, the current log is closed and a new log file is opened.

Interaction: The name of the new log file is determined by the value of the LOG= system option. If LOG= does not contain a directive, however, the name would never change, so the log would never roll over, even when ROLLOVER=AUTO.
NONE

specifies that rollover does not occur, even when a change occurs in the name that is specified with the LOG= option.

Interaction: If the LOG= value contains any directives, they do not resolve. For example, if Log="#b.log" is specified, the directive "#" does not resolve, and the name of the log file remains "#b.log".
SESSION

at the beginning of each SAS session, opens the log file, resolves directives that are specified in the LOG= system option, and uses its resolved value to name the new log file. During the course of the session, no rollover is performed.

n |nK |nM |nG

causes the log to rollover when the log reaches a specific size, stated in multiples of 1 (bytes); 1,024 (kilobytes); 1,048,576 (megabytes); or 1,073,741,824 (gigabytes). When the log reaches the specified size, it is closed and renamed by appending "old" to the log filename, and if it exists, the lock file for a server log. For example, a filename of 2008Dec01.log would be renamed 2008Dec01old.log. A new log file is opened using the name specified in the LOG= option.

CAUTION:
Old log files can be overwritten.

SAS maintains only one old log file with the same name as the open log file. If rollover occurs more than once, the old log file is overwritten.  [cautionend]

Restriction: The minimum log file size is 10K.
See also: "Log Filenames" in SAS Language Reference: Concepts
Default: NONE
Interaction: Rollover is triggered by a change in the value of the LOG= option.
Restriction: Rollover will not occur more often than once a minute.
See Also: LOG= system option under Windows, UNIX, z/OS
WRITE=BUFFERED | IMMEDIATE

specifies when content is written to the SAS log.

BUFFERED

writes content to the SAS log only when a buffer is full in order to increase efficiency.

IMMEDIATE

writes to the SAS log each time that statements are submitted that produce content for the SAS log. SAS does no buffering of log messages.

Default: BUFFERED
Tip: Under Windows, the buffered log contents are written periodically, using an interval that is specified by SAS.

Details

The LOGPARM= system option controls the opening and closing of SAS log files when SAS is operating in batch mode or in line mode. This option also controls the naming of new log files, in conjunction with the LOG= system option and the use of directives in the value of LOG=.

Using directives in the value of the LOG= system option enables you to control when logs are open and closed and how they are named, based on actual time events, such as time, month, and day of week.

Operating Environment Information:   Under the Windows and UNIX operating environments, you can begin directives with either the % symbol or the # symbol, and use both symbols in the same directive. For example, -log=mylog%b#C.log.

Under z/OS, begin directives only with the # symbol. For example, -log=mylog#b#c.log.

Under OpenVMS, begin directives only with the % symbol. For example, -log=mylog%b%c.log.  [cautionend]

The following table contains a list of directives that are valid in LOG= values:

Directives for Controlling the Name of SAS Log Files
Directive Description Range
%a or #a Locale's abbreviated day of week Sun-Sat
%A or #A Locale's full day of week Sunday-Saturday
%b or #b Local's abbreviated month Jan-Dec
%B or #B Locale's full month January-December
%C or #C Century number 00-99
%d or #d Day of the month 01-31
%H or #H Hour 00-23
%j or #j Julian day 001-366
%l or #l * User name alphanumeric string that is the name of the user that started SAS
%M or #M Minutes 00-59
%m or #m Month number 01-12
%n or #n Current system node name (without domain name) none
%p or #p * Process ID alphanumeric string that is the SAS session process ID
%s or #s Seconds 00-59
%u or #u Day of week 1= Monday-7=Sunday
%v or #v * Unique identifier alphanumeric string that creates a log filename that does not currently exist
%w or #w Day of week 0=Sunday-6=Saturday
%W or #W Week number (Monday as first day; all days in new year preceding first Monday are in week 00) 00-53
%y or #y Year without century 00-99
%Y or #Y Full year 1970-9999
%% Percent escape writes a single percent sign in the log filename. %
## Pound escape writes a single pound sign in the log filename. #
* Because %v, %l, and %p are not a time-based format, the log filename will never change after it has been generated. Therefore, the log will never roll over. In these situations,specifying ROLLOVER=AUTO is equivalent to specifying ROLLOVER=SESSION.

Operating Environment Information:   See the SAS companion for z/OS for limitations on the length of the log filename under z/OS.  [cautionend]

Note:   Directives that you specify in the LOG= system option are not the same as the conversion characters that you specify to format logging facility logs. Directives specify a format for a log name. Conversion characters specify a format for log messages. Directives and conversion characters that use the same characters might function differently.  [cautionend]

Note:   If you start SAS in batch mode or server mode and the LOGCONFIGLOC= option is specified, logging is done by the SAS logging facility. The traditional SAS log option LOGPARM= is ignored. The traditional SAS log option LOG= is honored only when the %S{App.Log} conversion character is specified in the logging configuration file. For more information, see SAS Logging Facility in SAS Logging: Configuration and Programming Reference.  [cautionend]


Examples

Operating Environment Information:   The LOGPARM= system option is executed when SAS is invoked. When you invoke SAS at your site, the form of the syntax is specific to your operating environment. See the SAS documentation for your operating environment for details.  [cautionend]


See Also

"The SAS Log" in SAS Language Reference: Concepts

Previous Page | Next Page | Top of Page