It is easy to enable IIS Failed request log on IIS 7+. First we need to enable Health and Diagnostic feature in Web Server Role via Server manager. Note that the feature is enabled by default on Windows Azure Role instances.
Once enabled, open IIS management console and navigate to Site node. There is a [Failed Request Tracing] link in Action panel, click on it to bring up Failed Request Tracing dialog box
Enable this feature, specify desired log directory and max. files then close it.
Now we can set Site leave or Application level trace files, in my example, I am going to enable Application level trace. So navigate to my web application, in content panel, a [Failed Request Tracing Rule] allows us to configure our desired rules for tracing this application.
Note that default log file path on Windows Azure is set to C:\Resources\directory\$DEPLOYMENT ID$.$RoleName$.DiagnosticStore\FailedReqLogFiles\$ProjecName$\$WCSVC ID$\
Open it and click on [Add…] link in Action panel to bring up configuration dialog box, we have several options here, in my example, I am going to enable trace files for ASPX requests.
Log status codes start from 400 to 599.
Her I just accept the defaults.
Once completed, a new rule is created.