I've enabled diagnostics (per
my answer here). Now when I try to add a custom message to the log by:
in Global.asax (after diagnostic init obviously!)
EventLog.WriteEntry("Demo Webrole", "This is a message from global.asax", EventLogEntryType.Information);
I get a security exception as
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level
in the configuration file.
Exception Details: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is
unique. Inaccessible logs: Security.
So now it seems the default Windows Azure configuration won't allow log creation and I don't want to fight the platform by hacking priviledges etc (.NET trust level is "Full" by the way).
Our requirement is simple: We need a simple cloud aware diagnostic infrastructure so we can focus on the business logic itself.
So my question is: What is the simplest, straightforward way to get log messages out from the application into some persistant place? Code or links to working tutorials would be great!