SAS System Options |
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=
|
when a log file already exists, specifies how the contents of the existing file are treated.
appends the log when opening an existing file. If the file does not already exist, a new file is created.
overwrites the current contents when opening an existing file. If the file does not already exist, a new file is created.
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.
Default: | REPLACE |
specifies when or if the SAS log "rolls over". That is, when the current log is closed and a new one is opened.
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.
specifies that rollover does not occur, even when a change occurs in the name that is specified with the LOG= option.
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.
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.
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.
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 |
specifies when content is written to the SAS log.
writes content to the SAS log only when a buffer is full in order to increase efficiency.
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.
The following table contains a list of directives that are valid in LOG= values:
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.
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.
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.
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.
Rolling over the log at a certain time and using directives to name the log according to the time: If this command is submitted at 9:43 AM, this example creates a log file called test0943.log, and the log rolls over each time the log filename changes. In this example, at 9:44 AM, the test0943.log file will be closed, and the test0944.log file will be opened.
sas -log "test%H%M.log" -logparm "rollover=auto"
Preventing log rollover but using directives to name the log: For a SAS session that begins at 9:34 AM, this example creates a log file named test0934.log, and prevents the log file from rolling over:
sas -log "test%H%M.log" -logparm "rollover=session"
Preventing log rollover and preventing the resolution of directives: This example creates a log file named test%H%M.log, ignores the directives, and prevents the log file from rolling over during the session:
sas -log "test%H%M.log" -logparm "rollover=none"
Creating log files with unique identifiers: This example uses a unique identifier to create a log file with a unique name:
sas -log "test%v.log" -logparm "rollover=session"SAS replaces the directive %v with process_IDvn, where process_ID is a numeric process identifier that is determined by the operating system and n is an integer number, starting with 1. The letter v that is between process_ID and n is always a lowercase letter.
For this example, process_ID is 3755. If the file does not already exist, SAS creates a log file with the name test3755v1.log. If test3755v1.log does exist, SAS attempts to create a log file by incrementing n by 1, and this process continues until SAS can generate a log file. For example, if the file test3755v1.log exists, SAS attempts to create the file test3755v2.log.
Naming a log file by the user that started SAS: This example creates a log filename that contains the user name that started the SAS session:
sas -log "%l.log" -logparm "rollover=session";
See Also |
"The SAS Log" in SAS Language Reference: Concepts |
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.