The web browser trick: A little-known but very effective solution is to open your .log file directly with a browser (Internet Explorer, Chrome, Edge, etc.). The browser does not lock the file and displays the text correctly (especially if the extension is .log, the formatting remains readable).
Note : The "Dashboard" Solution: PROC PRINTTO and HTML
To go beyond simple text reading, you can redirect your logs to an HTML format. This allows you to create real monitoring dashboards (with colored statuses: green for finished, yellow for in progress, etc.).
The idea is to use the PROC PRINTTO procedure to route the log to an HTML file. Here is an example of a macro proposed by the community:
%MACRO PRINTTO(_logPath=, _jobID=, _jobName=);
%LOCAL dt;
%LET dt = %sysFunC(dateTime(), DATETIME16.);
/* Initialisation du fichier HTML */
FILENAME L_PATH "&_logPath";
DATA _null_;
file L_PATH;
put "<PRE>"; /* Balise pour conserver le formatage */
RUN;
FILENAME L_PATH CLEAR;
/* Redirection de la log */
PROC PRINTTO LOG = "&_logPath";
RUN;
%PUT NOTE: Job &_jobID - &_jobName a demarre a &dt;
%MEND;
1
%MACRO PRINTTO(_logPath=, _jobID=, _jobName=);
2
%LOCAL dt;
3
%LET dt = %sysFunC(dateTime(), DATETIME16.);
4
5
/* Initialisation du fichier HTML */
6
FILENAME L_PATH "&_logPath";
7
DATA _null_;
8
file L_PATH;
9
put "<PRE>"; /* Balise pour conserver le formatage */
10
RUN;
11
FILENAME L_PATH CLEAR;
12
13
/* Redirection de la log */
14
PROC PRINTTO LOG = "&_logPath";
15
RUN;
16
17
%PUT NOTE: Job &_jobID - &_jobName a demarre a &dt;
18
%MEND;
By opening this HTML file in a browser and using automatic refresh, you can comfortably track the progress of your jobs.
The Empty File Problem (Buffering)
Even if you manage to open the file, its size often remains stuck at 0 KB or does not update for long periods, even if the program is running.
Limitations: Although very useful, this option does not always guarantee an instant, second-by-second update (it also depends on the disk load and the OS), but it significantly reduces the delay in the appearance of logs.
You can also combine this with the -logparm option:
-logparm "write=immediate rollover=session"
4. Third-party Tools: Bringing Unix to Windows
If you miss tail -f too much, the radical solution is to install utilities that bring Unix commands to Windows. Tools like GnuWin32, UnxUtils, or Cygwin allow you to use tail on Windows to monitor your log files exactly as you would on a Linux server.
Die auf WeAreCAS.eu bereitgestellten Codes und Beispiele dienen Lehrzwecken. Es ist zwingend erforderlich, sie nicht blind in Ihre Produktionsumgebungen zu kopieren. Der beste Ansatz besteht darin, die Logik zu verstehen, bevor sie angewendet wird. Wir empfehlen dringend, diese Skripte in einer Testumgebung (Sandbox/Dev) zu testen. WeAreCAS übernimmt keine Verantwortung für mögliche Auswirkungen oder Datenverluste auf Ihren Systemen.
SAS und alle anderen Produkt- oder Dienstleistungsnamen von SAS Institute Inc. sind eingetragene Marken oder Marken von SAS Institute Inc. in den USA und anderen Ländern. ® zeigt die Registrierung in den USA an. WeAreCAS ist eine unabhängige Community-Site und nicht mit SAS Institute Inc. verbunden.
Diese Website verwendet technische und analytische Cookies, um Ihre Erfahrung zu verbessern.
Mehr erfahren.