2

I am using sas eg 5.1 version. right now I am routing my log details to an external file(text document) for record keeping. But while developing a code, I want the error log to appear in the sas egp log window also, so that it makes debugging faster and easy

So my question is how to have sas log details in both sas egp and in external file at the same time

I tried searching for it, but could not get the details.

Thanks in advance

1 Answers1

2

There is no 'in session' programmable option to write the log to multiple destinations. However a decent 'hack' is to simply read your external log and write out to your session log as follows:

/* write to external log */
filename tmp "C:\temp\mylog.txt";
proc printto log=tmp; run;

/* now run your SAS code */
%put NOTE: processing lots of juicy SAS statements;

/* once done, return to normal logging */
proc printto log=log; run; 

/* print previous log to current session */
data _null_;
  infile tmp;
  input; list;
run;

/* close filename */
filename tmp clear;

To ensure you always write the log out / get it back, you could even split the above into the following locations:

EG dialog box showing custom code to run before & after task

Other options:

An admin can enable logging on the application (workspace) server. This will capture all logs, from all users - which does have performance and storage implications! Steps as follows:

  • Navigate to: [sasconfig]\Lev1\SASApp\WorkspaceServer
  • Rename logconfig.xml to logconfig.xml.orig
  • Rename Logconfix.trace.xml to logconfig.xml
  • Restart the object spawner

Another approach, as proposed by @Quentin / @Reeza in this (very similar) question, is to use the -altlog option at SAS invocation.

Finally, if it suits, you could look at enabling the EG project log.

Community
  • 1
  • 1
Allan Bowe
  • 12,306
  • 19
  • 75
  • 124
  • Thank you RawFocus very much. It is very helpful to me – Mani Prakash T Oct 19 '16 at 18:20
  • Glad to hear it, and welcome to stackoverflow! If you are happy with an answer on this site, the best response is always to mark an answer as accepted - see tick mark above and to the left :-) – Allan Bowe Oct 20 '16 at 07:13