English 中文(简体)
Logging SAS scripts
原标题:
  • 时间:2009-11-11 08:13:20
  •  标签:
  • logging
  • sas

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.

问题回答

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

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;

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





相关问题
Best logging approach for composite app?

I am creating a Composite WPF (Prism) app with several different projects (Shell, modules, and so on). I am getting ready to implement logging, using Log4Net. It seems there are two ways to set up the ...

How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

How to validate Java logging properties files?

I have a basic facility for allowing users to remotely apply changes to the logging files in my application. Some logs are configured using java.util.logging properties files, and some are configured ...

Logging SAS scripts

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 ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

热门标签