Recently while working on an incident I found that if you use Windows Azure Startup task with launch some application along with command line redirection (to collect log) directly as below, it may not launch the startup task:
As startup task will not be launched, there will not be any command line redirection log collected. After little more work I found that most of the std* redirection are done directly from BATCH/CMD script in the Startup task and works fine. Redirection directly from startup commandline is not suggested and to solve this problem what you can do is create a launcher.bat and place the command + redirection code to get it working.
Step 1: First create a batch file which includes the command line as required (Launcher.bat)
1: @ECHO ON2: @ECHO "Launcher"3: md C:\temp4: Startup\Application.exe >> C:\temp\logfilename.log 2>&1
Step 2: After it modify the ServiceDefinition to use launcher.bat as commandline as below:
After I modified the startup code as above and did test in a web role with Windows Azure VM everything worked fine.