I am seeing that the log information from a SAS Stored Process (STP) is appended to the .log file only upon completion of the STP. I want to monitor long running STPs by tailing the STP log file. Is there a way to get SAS to write the log information immediately instead of this delayed behavior?
Example: I kick off an STP (stp_test.sas) and tail the log file. The last line see is:
2016-02-19T11:05:03,630 INFO  :sassrv -  STPXUTL Execute using file path: /SAS/SASHome/SASFoundation/9.4/sasstp/stp_test.sas
Only upon completion (53 seconds later) I get the following next lines including specifically the NOTES that are important to me.
2016-02-19T11:05:56,634 INFO  8:sasmi - STP: 3: Execution Complete. Status=4 2016-02-19T11:05:56,678 INFO  8:sasmi - NOTE: %INCLUDE (level 1) file /SAS/SASHome/SASFoundation/9.4/sasstp/stp_test.sas is file /SAS/SASHome/SASFoundation/9.4/sasstp/stp_test.sas. 2016-02-19T11:05:56,679 INFO  8:sasmi - NOTE: PROCEDURE SQL used (Total process time): 2016-02-19T11:05:56,679 INFO  8:sasmi - real time 0.00 seconds 2016-02-19T11:05:56,679 INFO  8:sasmi - cpu time 0.01 seconds
Maybe I am not the most appropriate person to answer your question, but let me give it a try:
If you need additional details on the log, maybe you would like to increase your log level to debug (and/or enable the macro debug options on the code).
Still, this might add too much information on your logs and not the information you expect, because SAS only writes to the log when a procedure is finished or with explicit statements in your code.
Said this, and as common programming procedure, what I would really advise you is to include those explicit statements (eg %put statements) to write extra lined on your log or a different log file, if you will
The stored process server logging is controled by the log4sas facility. The file that allows you to control this is most likely logconfig.xml (but could be different, under control of the logconfigloc SAS invocation option).
There is one parameter that may help you achieve what you want. Add this to logconfig.xml file:
<param name="ImmediateFlush" value="TRUE"/>
Maybe also the SAS option UNBUFLOG will help but I am uncertain how well that plays with log4sas. Seems worth a try. You will not get log lines any faster than that.
Be aware of possible trade-offs like additional processing and I/O overhead.
Hope this helps.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.