I'm trying to use the the Logging Exception Handler from The Enterprise Library, but once in a while when I refresh the page (obviously), I get this error:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The LogWriter is already set.
protected void Page_Load(object sender, EventArgs e)
LogEntry entry = new LogEntry();
entry.Message = "I am logging";
[InvalidOperationException: The LogWriter is already set.]
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.SetLogWriter(LogWriter logWriter, Boolean throwIfSet) +165
ASPUserManager.Presentation.AspNetUI.GridView.Page_Load(Object sender, EventArgs e) in \AspNetUI\GridView.aspx.cs:20
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
I'm thinking maybe I should check if LogWriter is already set?
I'm new to The Enterprise Library Logging Application Block and I'm not sure how to fix this, does anyone have any idea?