<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting log parameters for ALTLOG in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688872#M20274</link>
    <description>&lt;P&gt;Have you tried &lt;A href="https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p1hwvc03z4tqlkn1owzhzo8e7ulu.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;PROC PRINTTO&lt;/A&gt;&amp;nbsp;and macro variable &lt;A href="https://go.documentation.sas.com/?docsetId=hostwin&amp;amp;docsetTarget=p1kxial1o2r732n1k3i137zh44n1.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;SYSJOBID&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sascmd="!sascmd";
signon test;
rsubmit;
filename testlog "C:\Temp\test_&amp;amp;sysjobid..log";
proc printto log=testlog;
run;
proc setinit; run;
endrsubmit;
signoff test;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Oct 2020 13:33:59 GMT</pubDate>
    <dc:creator>gwootton</dc:creator>
    <dc:date>2020-10-05T13:33:59Z</dc:date>
    <item>
      <title>Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688693#M20256</link>
      <description>&lt;P&gt;I have a scheduled job running on the Schedule Manager. I'm not able to access the log file so I routed the AltLog to a place I can get to. I want to add the date and time parameters to the log file so I modified my batch command like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/opt/sas/sascompute/config/Lev1/SASApp/BatchServer/sasbatch.sh 
-log /opt/sas/sascompute/config/Lev1/SASApp/BatchServer/Logs/Testing_JeffB_AltLog_AltLog_Testing_  
-batch -noterminal 
-altlog /opt/sas/data/sas_imi_reports/Testing/JeffB/AltLog/Altlog_#H#M.log 
-logparm "rollover=session"  -sysin /opt/sas/data/sas_imi_reports/scheduler/AltLog_Testing.sas &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem is instead of getting the hour and month of in the log file&amp;nbsp; I get the a file literally named Altlog_#H#M.log&lt;/P&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;
&lt;P&gt;Thank you SAS friends,&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2020 14:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688693#M20256</guid>
      <dc:creator>SAShole</dc:creator>
      <dc:date>2020-10-03T14:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688701#M20257</link>
      <description>&lt;P&gt;That's weird. That should work.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try it with % instead of #.&amp;nbsp; It shouldn't make any difference, but let's try the easy and obvious first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2020 15:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688701#M20257</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-03T15:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688703#M20258</link>
      <description>I tried using %'s  but get the same result</description>
      <pubDate>Sat, 03 Oct 2020 15:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688703#M20258</guid>
      <dc:creator>SAShole</dc:creator>
      <dc:date>2020-10-03T15:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688705#M20259</link>
      <description>&lt;P&gt;Well, crud.&amp;nbsp; It was worth a shot, I suppose.&amp;nbsp; "#" typically works best on Windows, but "%" I've used successfully for Linux/Posix/Unix. I just looked at one that I'm using:&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;-log I:\commercial\%env%\pgm\logs\0_CSI_Sus_#Y-#m-#d_#H-#M-#s_#p.log&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a -log not -altlog, but they&amp;nbsp;&lt;EM&gt;should&lt;/EM&gt; work the same.&amp;nbsp; Your log directives look like mine, so I don't see why they're not working.&amp;nbsp; One note:&amp;nbsp; There is a difference between #M (current minutes) and #m (current month), but since none of the log directives are working, I don't suppose that matters much right now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you were generating the statements with a program, I'd suggest just coding things with a script or with SAS, but I don't think you can do that here.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975"&gt;@gwootton&lt;/a&gt;&amp;nbsp;can provide us with further insight.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2020 15:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688705#M20259</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-03T15:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688708#M20260</link>
      <description>This is because the Batch Server uses LOGCONFIGLOC to specify a logging configuration XML file. This causes the ALTLOG option (as well as the LOG option) to not translate those characters.&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;-altlog /opt/sas/data/sas_imi_reports/Testing/JeffB/AltLog/Altlog_$(date +%Y-%m-%d_%H%M%S).log</description>
      <pubDate>Sat, 03 Oct 2020 16:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688708#M20260</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2020-10-03T16:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688716#M20261</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975"&gt;@gwootton&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, that looks like Unix/Linux/Posix syntax.&amp;nbsp; Is there something that would work with Windows?&amp;nbsp; In particular, I want something that can put the Process ID into the log file name via an -altog for a SAS Connect session (i.e. submitted via RSUBMIT).&amp;nbsp; #p doesn't work (no log directives work as far as I have been able to determine).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2020 19:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688716#M20261</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-03T19:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688859#M20271</link>
      <description>&lt;P&gt;That worked! Thanks!&lt;BR /&gt;&lt;BR /&gt;Oddly enough though, when I add this code to a job that runs every morning, no long file is generated. Do you know why that could be? Does the order of the parameters in the command line matter? Is my filename too long? I can't think of what else it could be?&lt;BR /&gt;&lt;BR /&gt;-altlog /opt/sas/data/sas_reports_analytics/scheduler/filename_vs_filename_$(date +%Y-%m-%d_%H%M%S).log&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 11:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688859#M20271</guid>
      <dc:creator>SAShole</dc:creator>
      <dc:date>2020-10-05T11:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688863#M20273</link>
      <description>Did you reschedule the job after doing so? Note that this will only work with the Operating System Scheduler, in my testing this was blocked by other schedulers (Distributed In-Process Services Scheduling Server and Platform Process Manager).</description>
      <pubDate>Mon, 05 Oct 2020 12:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688863#M20273</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2020-10-05T12:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688872#M20274</link>
      <description>&lt;P&gt;Have you tried &lt;A href="https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p1hwvc03z4tqlkn1owzhzo8e7ulu.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;PROC PRINTTO&lt;/A&gt;&amp;nbsp;and macro variable &lt;A href="https://go.documentation.sas.com/?docsetId=hostwin&amp;amp;docsetTarget=p1kxial1o2r732n1k3i137zh44n1.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;SYSJOBID&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sascmd="!sascmd";
signon test;
rsubmit;
filename testlog "C:\Temp\test_&amp;amp;sysjobid..log";
proc printto log=testlog;
run;
proc setinit; run;
endrsubmit;
signoff test;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Oct 2020 13:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/688872#M20274</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2020-10-05T13:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/689078#M20282</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975"&gt;@gwootton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Have you tried &lt;A href="https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p1hwvc03z4tqlkn1owzhzo8e7ulu.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;PROC PRINTTO&lt;/A&gt;&amp;nbsp;and macro variable &lt;A href="https://go.documentation.sas.com/?docsetId=hostwin&amp;amp;docsetTarget=p1kxial1o2r732n1k3i137zh44n1.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;SYSJOBID&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sascmd="!sascmd";
signon test;
rsubmit;
filename testlog "C:\Temp\test_&amp;amp;sysjobid..log";
proc printto log=testlog;
run;
proc setinit; run;
endrsubmit;
signoff test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;An excellent idea, and one I'm pretty sure would work.&amp;nbsp; The only drawback to PROC PRINTTO is that then the logs from the sub-processes will not get brought into the main log.&amp;nbsp; Maybe I can live with that, but I'll have to think about it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The advantage of ALTLOG is that I can "have my cake and eat it too."&amp;nbsp; I get an individual sub-process log which is super helpful in debugging or monitoring long-running, complex jobs,&amp;nbsp;&lt;STRONG&gt;and&lt;/STRONG&gt;&amp;nbsp;at end of job I get a single, consolidated log containing not only the supervisor process log but all all of the sub-process logs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET		Pgm						=	2_CSI_CPT_Related_Suspects;
%LET		Process_Name			=	CPT_Rela;
%LET		&amp;amp;Process_Name._RC		=	0;
%LET		Cmd_String				=	!sascmdv -logparm 'write=immediate rollover=session'  -memsize 8G 
-altlog &amp;amp;Log_Path\sub_process_logs\&amp;amp;Pgm._%Get_Date(FORMAT=YYMMDDD10)_%Get_Time(FORMAT=b8601tm6).log;
*-altlog &amp;amp;Log_Path\sub_process_logs\&amp;amp;Pgm._#Y-#m-#d_#H-#M-#s_#p.log;
%PUT		&amp;amp;Nte2	&amp;amp;=Cmd_String;
OPTION		SASCMD					=	"&amp;amp;Cmd_String";

OPTION		REMOTE					=	&amp;amp;Process_Name;
%SYSLPUT	_CLIENTTASKLABEL		=	&amp;amp;Pgm;
%SYSLPUT	Process_Name			=	&amp;amp;Process_Name;
%SYSLPUT	Prompt					=	&amp;amp;Prompt;
%SYSLPUT	Pgm						=	&amp;amp;Pgm;
%SYSLPUT	Pgm_Path				=	&amp;amp;Pgm_Path;
%SYSLPUT	Environment				=	&amp;amp;Environment;

RSUBMIT	PROCESS=&amp;amp;Process_Name		WAIT=NO	PERSIST=NO;
	%INC	"&amp;amp;Pgm_Path\&amp;amp;Pgm..sas";
ENDRSUBMIT;

%Check_RC	(MsgLvl=&amp;amp;MsgLvl, ErrLvl=&amp;amp;ErrLvl, Email=&amp;amp;Email, Err=&amp;amp;Err, 
			FROM=&amp;amp;From, TO=&amp;amp;To, SUBJ=&amp;amp;Subj, Debug=&amp;amp;Debug, Trace=&amp;amp;Trace,
			CC1=&amp;amp;CC1, CC2=&amp;amp;CC2, CC3=&amp;amp;CC3, CC4=&amp;amp;CC4, CC5=&amp;amp;CC5, 
			CC6=&amp;amp;CC6, CC7=&amp;amp;CC7, CC8=&amp;amp;CC8, CC9=&amp;amp;CC9, 
			Msg1=&amp;amp;Msg1, Msg2=&amp;amp;Msg2, Msg3=&amp;amp;Msg3, 
			Msg4=&amp;amp;Msg4, Msg5=&amp;amp;Msg5, Msg6=&amp;amp;Msg6);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can see where I've tried the -altlog with the log directives, but all of the log directives are placed as literals in the name of the log file (not very helpful).&amp;nbsp; The code above gives me date and time, which isn't bad, but when I'm looking at the Processes in Task Manager, it would be really nice to have the Process ID embedded in the log file name so I'd know which log file corresponded to which process in Task Manager without having to open each log.&amp;nbsp; Sometimes I'll be running a dozen or so sub-processes, and it's a bit of a hassle to go opening log files until I find the one I want.&amp;nbsp; I was hoping there was something slick available like what you shared with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7900"&gt;@SAShole&lt;/a&gt;.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2020 04:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/689078#M20282</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-06T04:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/689265#M20292</link>
      <description>&lt;P&gt;Well we can't know the PID until the session starts, but date and time we can pull from functions into a macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let suffix = %sysfunc(date(),YYMMDDn8.)_%sysfunc(compress(%sysfunc(time(),time.),%str( :)));
options sascmd="!sascmd -altlog C:\Temp\altlog_&amp;amp;suffix..log";
signon test;
rsubmit;
proc setinit; run;
endrsubmit;
signoff test;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Oct 2020 16:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/689265#M20292</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2020-10-06T16:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting log parameters for ALTLOG</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/689269#M20293</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975"&gt;@gwootton&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, rats.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's interesting that regular batch SAS submission knows how to emplace the PID in the log file name even though the PID isn't known at the time of instanciation but SAS Connect cannot.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I guess my choices are:&lt;/P&gt;
&lt;P&gt;a)&amp;nbsp; Continue to use Altlog and just deal with it that I can't have PID in my sub-process log file names&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; -or-&lt;/P&gt;
&lt;P&gt;b)&amp;nbsp; Use Proc PRINTTO and accept the loss of the sub-process logs from the main log file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2020 16:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Getting-log-parameters-for-ALTLOG/m-p/689269#M20293</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-06T16:58:43Z</dc:date>
    </item>
  </channel>
</rss>

