Home All Groups Group Topic Archive Search About

Tracing with web.config

Author
20 Apr 2006 3:41 PM
Mitkip
Hello,

I just want to know if it's possible to trace an application into a
dedicated EventLog by just adding a new tag in web.config. I don't to
have to create it by coding something like : ev as new
EventLog("MyEventLog").

How to do it ?

Thanks ;)

Author
20 Apr 2006 4:25 PM
Nicole Calinoiu
Yes, this is possible, but only for a web application that runs with
unrestricted CAS permissions (full trust).  To do this, simply use the
writeToDiagnosticsTrace of the system.web\trace element
(http://msdn2.microsoft.com/en-us/library/6915t83k(VS.80).aspx) to specify
that the ASP.NET trace should be written to the System.Diagnostics trace.
You'll also need to configure trace listeners.  See the "Routing All Tracing
Output to .NET Framework Tracing" section at
http://msdn2.microsoft.com/en-US/library/b0ectfxd(VS.80).aspx for an
example.  Just watch out for the consequences of using
writeToDiagnosticsTrace--it copies trace entries to the diagnostics trace
rather than forwarding them as at least some of the documentation would seem
to indicate.  (i.e.: The system.web\trace configuration element will still
dictate how the trace may be viewed via your application.)


Show quote
"Mitkip" <mit***@gmail.com> wrote in message
news:1145547689.012744.273480@g10g2000cwb.googlegroups.com...
> Hello,
>
> I just want to know if it's possible to trace an application into a
> dedicated EventLog by just adding a new tag in web.config. I don't to
> have to create it by coding something like : ev as new
> EventLog("MyEventLog").
>
> How to do it ?
>
> Thanks ;)
>
Author
24 Apr 2006 10:24 AM
Mitkip
Does your answer only apply with .NET 2 ? I'm using 1.1 ... :-(
Author
24 Apr 2006 1:57 PM
Nicole Calinoiu
Yes, the TraceContext to Trace copying only works in 2.0.  AFAIK, for 1.1,
there is no configuration-only solution to writing from the TraceContext to
the event log.



Show quote
"Mitkip" <mit***@gmail.com> wrote in message
news:1145874251.685193.229130@i40g2000cwc.googlegroups.com...
> Does your answer only apply with .NET 2 ? I'm using 1.1 ... :-(
>
Author
24 Apr 2006 3:33 PM
Mitkip
OK, thanks

AddThis Social Bookmark Button