A
andrew.douglas11
Hello all,
I've been struggling on something that should be very easy. I want to
log every unhandled exception that occurs in my web app to a text
file. With the introduction of health monitoring in 2.0, this should
be super easy, but it's not. First off, there's no out-of-the-box
provider for logging to a text file which is very strange. Microsoft
at least provides some solutions to this problem on their website. I
have implemented the "SampleBufferedEventProvider" class found at the
following URLs:
Setup/Config: http://msdn2.microsoft.com/en-us/library/ms178718.aspx
Code: http://msdn2.microsoft.com/en-us/library/ms227676.aspx
This code does a good job of providing verbose exception information
and buffering it to a text file. The one major issue with this
provider is that the path to the log file must be hard-coded! If you
try to add a custom attribute to the provider node in Web.config, the
compiler barks at you. So my question is: can I somehow make a change
that will allow me to specify the path to the file or directory to log
to in the Web.config?
I noticed in another Microsoft solution to this issue, the
"TextFileWebEventProvider" DOES have a logFileName attribute in its
Web.config. (http://msdn2.microsoft.com/en-us/library/aa479036.aspx)
Why does this provider get to have a logFileName attribute and the
other doesn't?
Thanks,
Andy
I've been struggling on something that should be very easy. I want to
log every unhandled exception that occurs in my web app to a text
file. With the introduction of health monitoring in 2.0, this should
be super easy, but it's not. First off, there's no out-of-the-box
provider for logging to a text file which is very strange. Microsoft
at least provides some solutions to this problem on their website. I
have implemented the "SampleBufferedEventProvider" class found at the
following URLs:
Setup/Config: http://msdn2.microsoft.com/en-us/library/ms178718.aspx
Code: http://msdn2.microsoft.com/en-us/library/ms227676.aspx
This code does a good job of providing verbose exception information
and buffering it to a text file. The one major issue with this
provider is that the path to the log file must be hard-coded! If you
try to add a custom attribute to the provider node in Web.config, the
compiler barks at you. So my question is: can I somehow make a change
that will allow me to specify the path to the file or directory to log
to in the Web.config?
I noticed in another Microsoft solution to this issue, the
"TextFileWebEventProvider" DOES have a logFileName attribute in its
Web.config. (http://msdn2.microsoft.com/en-us/library/aa479036.aspx)
Why does this provider get to have a logFileName attribute and the
other doesn't?
Thanks,
Andy