Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I would like to set ,in build bat setting in the project property, date and jobName to output log file like below.
How can I do this?
%~d0
cd %~dp0
java -Dtalend.component.manager.m2.repository=%cd%/../lib ${talend.job.jvmargs} -cp ${talend.job.bat.classpath} ${talend.job.class} ${talend.job.bat.addition} %* >> log_YYYMMDD_jobName.txt 2>>&1
You can try to do this creating context variable and use it in bat file as bellow:
And inside bat file you will see
But I think, better way is using tJava component and create the filename automaticaly (instead of setting it in bat file) as bellow:
context.Parameter1 = "log_" + TalendDate.formatDate("yyyyMMdd_", TalendDate.getCurrentDate()) + jobName + ".txt";
I would like to set all in bat. I find ${talend.job.name} can retrieve the jobname.
How about YYYYMMDD ? Is this retrieved by something like %date% ?
set YYYYMMDD=....
%~d0
cd %~dp0
java -Dtalend.component.manager.m2.repository=%cd%/../lib ${talend.job.jvmargs} -cp ${talend.job.bat.classpath} ${talend.job.class} ${talend.job.bat.addition} %* >> log_YYYYMMDD_${talend.job.name}.txt 2>>&1
try this
set YYYYMMDD=%date:~10,4%%date:~3,2%%date:~0,2%
You are right , it is complicated in batch program if you are not sure of ShortDate format.
https://www.robvanderwoude.com/datetimentparse.php
I would suggest to use other utility like perl/groovy etc if you have in your environment.