- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello my helpers 🙂
I am using below code to route the log to a daily folder on the server and will use the macro %checklogs to pick up any error message or warnings from there.
* Create the daily folder on server;
%let loc=/../../&sysdate.;
x mkdir -p "&loc./";
proc printto log="&loc./daily_extract.log" NEW; run;
...
* Reset log;
proc printto; run;
Current issue I have:
1) the log is wrapped after everything been done, and will take quite a long time afterwards in order to write the log to the destination.
The user would have received the email notification that the programs have been completed, all the output results all properly generated in the physical location as required (PC location), and they would not notice that the program is still running at the back end and write to the log file since.
The user will then close SAS EG.
Below error message will be showing if someone else from the team runs the macro %checklogs of which will check all log files in the daily folder:
ERROR: File is in use, /../../log/09DEC20/daily_extract.log.
To address this issue,
1) I am going to reduce the log size by using options to control what info to be write to the log files so the time needed for wrapping the log files will be shortened. Any other suggestion regarding to use options?
Options nosource nomprint;
2) I would also like to get the log file write to the destination incrementally so the log file will be finished not long after the email notification. - Any ideas on how this can be achieved?
The %checklogs refer to:
https://support.sas.com/resources/papers/proceedings17/1173-2017.pdf
(trouble shooting also in my previous post)
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't see why the log should take so long to close. It written in short bursts once the log buffer is full.
Try adding this line to the config file:
-LOGPARM "WRITE=IMMEDIATE"
Also, shame on SAS for removing the very useful UNBUFLOG option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much for the advice.
It is quite a large program which includes lots of macros and programs to run.
it takes at least another 15 mins + (don't know how long exactly) to write the log file to the server after the program finished.
I will test the WRITE=IMMEDIATE and hope it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
> it takes at least another 15 mins + (don't know how long exactly) to write the log file to the server after the program finished.
I can't think of any reason this should ever happen.
This looks like a Tech Support issue, if you don't find a workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just a hint, born out of experience:
do not use &sysdate for a path. Use a properly formatted date instead:
%let loc=/../../%sysfunc(today(),yymmdd10.);
This will sort nicely and enable you to access a group of directories easy with simple wildcards (like 2020-10* for October)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kurt,
Awesome advice. That definitely improves the compatibility dealing with variations.
Thanks a log 🙂