470,849 Members | 681 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Traceswitch set in web.config not working

WT
Hello,
Using .NET 2 and visual studio 2005 for writting asmx web services.
For asp.net web sites I used to implement trace system using TraceSwitch set
in web.config.
Using
Trace.WireteLineIf(MySwitch.TraceError,"text");
in my code. Having defined TExtWriterTraceListener.
But this has no effect and I can't get any tracefile created, is this a
limitation of web services ?
Thanks for help
CS.
Jul 7 '06 #1
4 4351
Trace, when used without qualification in ASP.Net, refers to the Page.Trace
object which is, in reality a System.Web.TraceContext object.

To use a TraceSwitch, you need to use System.Diagnostics.Trace. Just
qualify your call to Trace and your TraceSwitch should work.

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA
"WT" wrote:
Hello,
Using .NET 2 and visual studio 2005 for writting asmx web services.
For asp.net web sites I used to implement trace system using TraceSwitch set
in web.config.
Using
Trace.WireteLineIf(MySwitch.TraceError,"text");
in my code. Having defined TExtWriterTraceListener.
But this has no effect and I can't get any tracefile created, is this a
limitation of web services ?
Thanks for help
CS.
Jul 8 '06 #2
Hi,

Thank you for your post.

Based on my understanding, your question is how to use
System.Diagnostics.Trace in ASP.NET web application. If I've misunderstood
anything, please feel free to post here.

In order for the trace to take effect, you need to recompile your
application with the trace flag set. You do that by setting the
compilerOptions attribute to ="/d:TRACE" in the configuration line for the
language compiler you want to support tracing. Other than configuration
<system.diagnosticsin web.config, you also need to modify the compiler
switch to enable trace flag:

<system.codedom>
<compilers>
<compiler language="c#;cs;csharp"
extension=".cs"
compilerOptions="/d:TRACE"
......

For more information, please refer to following MSDN Library article:

#Walkthrough: Integrating ASP.NET Tracing with System.Diagnostics Tracing
http://msdn2.microsoft.com/en-us/library/b0ectfxd.aspx

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Jul 10 '06 #3
WT
Thanks Walter, we discovered finally thta it is working.
We were using a bad directory for our tracefile, ACL were missing for the
web service account.

We have now a different problem, when we expect one tracefile nammed
MyTrace.log, we get it ....and several other files with names prefixed with
a Guid like number followed byè our tracefile name, just like
9513167865321879632Mytrace.log

Why asp.net is generating theses files ?

Thanks for help.
"Walter Wang [MSFT]" <wa****@online.microsoft.coma écrit dans le message
de news: 9f**************@TK2MSFTNGXA01.phx.gbl...
Hi,

Thank you for your post.

Based on my understanding, your question is how to use
System.Diagnostics.Trace in ASP.NET web application. If I've misunderstood
anything, please feel free to post here.

In order for the trace to take effect, you need to recompile your
application with the trace flag set. You do that by setting the
compilerOptions attribute to ="/d:TRACE" in the configuration line for the
language compiler you want to support tracing. Other than configuration
<system.diagnosticsin web.config, you also need to modify the compiler
switch to enable trace flag:

<system.codedom>
<compilers>
<compiler language="c#;cs;csharp"
extension=".cs"
compilerOptions="/d:TRACE"
......

For more information, please refer to following MSDN Library article:

#Walkthrough: Integrating ASP.NET Tracing with System.Diagnostics Tracing
http://msdn2.microsoft.com/en-us/library/b0ectfxd.aspx

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 11 '06 #4
Hi,

Thank you for your update.

I'm sorry I didn't mentioned that when the ASP.NET worker process is
running under a service account, that account will be used to access the
log file. Anyway, I'm glad you've figured that out, I'm sure your
experience will benefit the community a lot. Thank you for your effort!

As for the tracefile name gets changed, I was unable to reproduce the
problem here, would you please telling me more details such as the
web.config and your code to write log? Thank you!

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Jul 12 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Kevin Meiresonne | last post: by
2 posts views Thread by nhmark64 | last post: by
2 posts views Thread by PMac | last post: by
1 post views Thread by David | last post: by
13 posts views Thread by Khodr | last post: by
3 posts views Thread by Blasting Cap | last post: by
5 posts views Thread by =?Utf-8?B?SmVycnkgQw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.