This is not so much of a discussion, more of a sharing of information. I've found plenty of really useful fixes to some of my problems so I thought it time I shared something back! Some of you will may read this and have alternatives and better ways of doing this but hopefully it may prove useful to some. Please feel free to add to this any other examples which might also be useful (i'm fairly new to QlikView so I was quite pleased with myself when this all worked[:D]).
I have been working on a batch file for reloading an application from a scheduled job which I have added elements of logging into.
The first LOG file it creates captures the start and end time of the reload activity into the 'Reload.log'. If the file doesn't exist it creates it. If it does exist then the '>>' flag appends the date and time and string "Command Line Reload Start" into the log file. The batch file will continue to append the start and end times to the reload.log file unless you either delete the log file or clear all the entries. At this point it will then continue to append data to it.
It then reloads the application using the standard /r flag. Within the app itself I have set the ErrorMode to ZERO in order to suppress any error messages generated during the reload. These are however captured in the generated log file that the application creates.
The second file it creates is the error.log file. The batch file then tries to find the string 'Error:' within the generated LOG file and if it finds it, it copies the line of found text into a separate error log file - 'Error.log'.
The batch file then adds a further statement to the Reload.log to say the reload is complete. The batch file then closes.
** Batch file start**
echo off
echo.
cd\
echo Initialize the log file with Command Line reload...
echo %date% %time% "inforM Command Line Reload Start" >> "C:\Path to the log file\Reload.log"
echo Run QlikView and Reload Data...
"C:\Program Files\QlikView\QV.exe" /r "C:\Path to your App\QlikView.qvw"
echo Look through the log file for Errors...
echo Create Error Log File if a Data Load error is found...
Find /i "Error:" < "C:\Path to your AppQlikView.qvw.log" >> "C:\Path to the log file\Error.log"
echo %date% %time% "Command Line Reload Finished" >>"C:\Path to the log file\Reload.log"