Showing posts with label startup tasks. Show all posts
Showing posts with label startup tasks. Show all posts

Monday, May 9, 2011

Logging Azure startup tasks

This is one of the old DOS batch file tricks.  Really simple, really useful, and still works after 20+ years.

When you need to send the output of a script to a file:

>> pathToMyLog\Mylog.log

IN the case of Azure startup tasks and you want a quick way to see what happened, what is happening simply define this in the startup task.

image

<Startup>
  <Task commandLine="DSInstall\InstallDS.cmd >> %Public%\Documents\StartupTask.log" executionContext="elevated" />
</Startup>

The important thin got remember is that this will always append a previous file.  So if the script runs multiple times, you will have the entries repeat.  And this is also useful.

Most developers I would with would simply be looking at me and say:  Just turn on Intellitrace, support is right there.  Well, that is fine – I will let them do that.  But yet, I bet they find this useful.  Winking smile

There is also the final end tag of “2>>&1” that can be used to be sure that error messages are logged (as the “>>” takes all of the console output and logs it to file).