The SAS Logging Facility in the SAS Language |
The following appender and logger functions create regression and new function categories for testing a SAS program. This example assumes that filerefs that are named myPgmReg and myPgmNew have been created in the SAS program.
/* Define the destination where regression messages are written. */ 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; /* Define the destination where new function messages are to be written. */ 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; /* Create the context for logging regression messages. */ /* Regression log events of level info or higher are written * / /* to the destination specified by the appender defined as myPgmRegression. */ 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; /* Create the context for logging new function messages. */ /* New functionality log events of level debug or higher are written */ /* to the destination that is specified by the appender defined as myPgmNewFunction. */ if _n_=1 then do; rc=log4sas_logger("regression", "appender-ref=(myPgmNewFunction) level=debug"); if rc ne 0 then do msg = sysmsg(); put msg; ABORT; end; end;
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.