Posts

Showing posts from June, 2009

How to use Microsoft Enterprise Logging Application block in Medium Trust level?

1) Medium or less trust level does not allow access to the Windows Event Log (System.Diagnostics.EventLogPermission) 2) In the case where access to the Windows Event log is not allowed, I would recommed we write the Error or Trace logs to a Flat file under the root directory e.g. root\log\Error.log (In medium security the application only has access to the root directory and folders under it) 3) Add a section under the “web.config” file for logginConfiguration as shown below, make sure the requiredPersmission = “false” < section name = " loggingConfiguration " type = " Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " requirePermission = " false " /> 4) Add Flat File Listener under the logginConfiguration section Logging Application block allows writing to multiple