tags:

views:

124

answers:

3

I've been developing a lot of Java, PHP and Python. All of which offer great logging packages (Log4J, Log or logging respectively). This is a great help when debugging applications. Especially if the app runs headless.

Now, I have a SAS script that is supposed to run as a stored process. But for some reason, the execution seems to run very slow as soon as it runs as stored process. I'd like to do some logging, to see what the app is doing. And when it is doing it. So I can pinpoint the code that causes the execution to be slow.

I've been searching for some logging solution in SAS, but haven't found anything so far. Is there anything I could use? Appending to a text-file would be a good start. But logging to the windows event-log or a remote syslog service would be even better.

+3  A: 

There is a function "ntlog" that can write to the Windows event log. It's described on this page.

schinazi
+2  A: 

A quick search on support.sas.com gave me this link.

Usage Note 34114: Creating a detailed SAS® Stored Process Server log by default

http://support.sas.com/kb/34/114.html

Grem
+3  A: 

Another possiblility would be to redirect the log to a file. Example:

%let logPath = d:\sas.log;

/* Delete the old log */

data _null_;
    logFile = "mylog";
    rc = filename(logFile,"&logPath");
    if rc = 0 and fexist(logFile) then
       rc = fdelete(logFile);
    rc = filename(logFile);
run;

option nonotes nosource;

/* Redirect log to file */

proc printto log = "&logPath";
run;

%put >> File logging started <<;

%put ERROR: An error occured (macro);
%put WARNING: A warning occured (macro);

data _null_;
  put "ERROR: An error occured inside my data step";
run;

%put >> File logging ended <<;

/* Turn standard logging on again */

proc printto; 
run;

option notes source;

%put NOTE: Back to session log;
Luke Skywalker