DATA Step, Macro, Functions and more

Viewing log files

Reply
N/A
Posts: 0

Viewing log files

When running SAS interactively, you can see the developing log file in the log window. When running SAS in batch on Unix, you can still watch the log with more or less or tail -f. Is there some viewing tool in Windows that will let you watch the log file while a long SAS job is running? Notepad and Wordpad don't work, because Windows won't allow the access. Is there some way around this?


On a side note.

I like the new forums, but could we have one more = OS and Server related stuff/issues. A place where we can talk about the above kinds of things, shell scripted wrappers for SAS, scheduler products, z/OS JCL that can affect/help SAS, etc. Message was edited by: Chuck
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
Hi,

Use PROC PRINTTO and PUT log to HTML. Then through IE you can watch logs online. I'm using it on every project.

Matej

Eg:

/*
PROGRAM: PRINTTO.SAS
Desc: Routing log to specific directory.
Date: 24.9.2004

Created By:
Author: Matej Komár
e-mail: Matej.Komar@comma.sk
Company: COMMA Consulting

Inputs:
_logPath - path to external log file.html
_jobID - Job ID
_jobName - Job Name
*/
%MACRO PRINTTO;
%LOCAL dt;
%LET dt = %sysFunC(dateTime(), DATETIME16.);
FILENAME L_PATH "&_logPath";
DATA _null_;
file l_path;
put "
";
RUN;
FILENAME L_PATH CLEAR;

PROC PRINTTO LOG = "&_logPath";
RUN;

%PUT NOTE: [CUBIS] Job &_jobID - &_jobName was started successfully at &dt;
%MEND;
/* Test macro
%LET _logPath = c:\temp\aaa.html;
%LET _jobName = mato;
%LET _jobID = mato;
%printTo;
%printBack;
*/
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
is the -altlog equally protected from access by notepad or ie ?

peterC
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
I think no. You can open log(-altlog option) in notepad for sure.
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
Boy do I feel dumb.

I had gotten into the habit of using WordPad instead of NotePad because it manages line wrapping better, and because it can open bigger log files.

NotePad can open a log file while the SAS job is running.
So can Internet Explorer -- this one is new to me, never thought of trying it.

Thanks matej

So, let's continue this. How do I get the log file to flush to disk faster so that I can better see the progress. The remote job has completed a data step and is now running a proc sql -- I know because I can follow the dataset creations -- but the log file is still 0 kB and so shows nothing.

By the way, I have already set -logparm "open=replace write=immediate rollover=session" Message was edited by: Chuck
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
The problem with using IE is that the formatting is all off. All the text runs together.

I see why you preloaded the file with

But, that is not an option in this case because the log file is specfied on the .. oh wait a minute.

Ok, if I leave the name *.log but then "Open with ..." IE, all the formatting stays.

Wahoo!

Thanks again.
I think this will do the trick.

p.s.
Viewing the log file in IE is actually cleaner than in Wordpad, I like it much better, no line wrapping. Message was edited by: Chuck
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
I have root summary.html. Columns N, GROUP_ID, GROUP_NAME, JOB_ID(link to detail log for every job), JOB_NAME, START, END, STATUS(colored, green - finished, yellow - running etc). It is “matrix” of jobs to be processed. Summary.html has auto refresh after 10 second. I‘m drinking coffee and playing Solitaire and waiting for red color:-) :-) :-)
Trusted Advisor
Posts: 2,115

Re: Viewing log files

Posted in reply to deleted_user
Chuck,

You could also add the Unix commands that you need to your Windows box. There is freeware available that include more, less and tail (Google: ) or you could just buy the fancy version from MKS Toolkits.

The 0K .log size problem that you mentioned earlier happens in Unix too. SAS writes the log in blocks (and the block-size is system dependent, based on disk utilization), so what you see as the 'end' is not necessarily 'current.'

Doc
N/A
Posts: 0

Re: Viewing log files

While SAS usually "commits" log data to disk in "pages", you can bypass this behaviour with the undocumented option "-unbuflog".

I use it for all my SAS sessions as a startup option, and along with -altlog makes a version of the log available and reasonably current. It is certainly more current than running the job without the option, but may still sit a little behind the game. Perhaps a Tech Support person could clarify.

However, I first used it because with errorabend in your options, you could lose a session, and have an incomplete log file. Very frustrating to run three hours, have the job abend and no log entry to tell you why it happened!!!

Kind regards

David
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
For some reason, -unbuflog is not working for me.
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
Starting with the obvious: you have specified it as part of your start up, haven't you? If you hadn't you'd have a log message saying it could only be defined at invocation. Have you any message? How do you know it isn't working?

UnBufLog was introduced in Version 8, there was another command used for version 6. I presume however you are working with SAS9.

My expectation is that the step code would be echoed to the log as the step is compiled, notes from within the step as they are generated, and the summary afterwards. Are you seeing behaviour other than this?

I fear we are straying a little from the constraints of this forum and Tech Support may be needed to offer suggestions and make further tests. Still, if this doesn't always work, I'd like to know so I can avoid a Frasier Crane moment when I suggest it to a new client.

Kind regards

David
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
Yes, I put it directly on the command line statement.

The reason I identified that it isn't working for me is that the log file didn't change from 0 kB any faster, and the first jump was to 476 kB well after having already performed some proc sql steps and some data steps (I know because the primary dataset had been created and there still was no log content).

There is no need for me to pursue this further at this time.
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
There's always something.

To deal with some problems, I uninstalled my SAS and EG and re-installed it.
Now IE won't open the log files, even with explicitly selecting "Open with ..."

Any clues?
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
is it the writing of the file or is it IE ?

try opening it in windows notepad

PeterC
N/A
Posts: 0

Re: Viewing log files

Posted in reply to deleted_user
Wordpad, notepad, word, EG, SAS all work fine.
IE is "working" except to display the .log and .lst files.
This only just broke with the re-install of SAS and SAS EG.
Ask a Question
Discussion stats
  • 14 replies
  • 834 views
  • 0 likes
  • 2 in conversation