What is the best practice to get error logging to appear in the console when deploying jobs?


Article ID: 181544


Updated On:


Deployment Solution





I am trying to use wlogevent in my scripts to send events to the Deployment Solution server in case of installation errors messages.

This is the command we execute in a script.
%SystemDrive%\WSSD\%jobname%\source\common\WLogEvent.exe -c:1337 -l:3 -ss:"%errormsg%"

The problem is that the message from wlogevent is only shown in the Deployment Solution console if I add a "pause" after executing the wlogevent command. If there is no pause after the wlogevent command, the custom message is replaced by the final status message when the job finishes.

What is the best practice to get the messages sent to the Deployment Solution console to remain persistent?

After looking at this in detail there appears to be only one way of this working and that’s to use the return codes part of the script job. You would use the following line to report the error code back to the Deployment Solution and then use the returns code part of the job to identify which error was received:

%SystemDrive%\WSSD\%jobname%\source\common\WLogEvent.exe -c: %errorlevel% -l:3 -ss:"Some error message here (irrelevant to the final status message)"

The downside of this method is that you would need to know the possible return codes ahead of the execution. Most popular codes can be included once as part of the Master Return Code facility to make the process easier.