Provider not executing
I want to implement a provider to do error-logging, but my provider is never called when an error is thrown.
My provider class looks like:
namespace DynF
{
public class LoggingProvider : System.Web.Management.BufferedWebEventProvider
{
public override void ProcessEventFlush(WebEventBufferFlushInfo flushInfo)
{
System.Diagnostics.Debug.WriteLine("logging!");
}
public override void ProcessEvent(WebBaseEvent eventRaised)
{
System.Diagnostics.Debug.WriteLine("logging!");
}
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
Syste开发者_Python百科m.Diagnostics.Debug.WriteLine("logging!");
}
public override void Shutdown()
{
System.Diagnostics.Debug.WriteLine("logging!");
}
}
}
in my web.config I have:
<system.web>
<healthMonitoring enabled="true">
<eventMappings>
<clear/>
<add name="All Errors"
type="System.Web.Management.WebBaseErrorEvent, System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"
startEventCode="0"
endEventCode="2147483647"/>
</eventMappings>
<providers>
<clear/>
<add name="LoggingProvider" type="DynF.LoggingProvider"/>
</providers>
<rules>
<clear/>
<add name="LogAllErrors"
eventName="All Errors"
provider="LoggingProvider"/>
</rules>
</healthMonitoring>
</system.web>
When running a testpage that throws a NonImplementedException, the LoggingProvider never outputs "logging!" (and no breakpoints no matter where put in the LoggingProvider class makes the application stop). I read this tutorial and as far as I understand it this should be enough to make it work.
What is it that I'm missing here?
I needed to add buffermode to false.
<add name="LoggingProvider" type="DynF.LoggingProvider" buffer="false"/>
精彩评论