473,231 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

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 4474
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Meiresonne | last post by:
I have developed an XML-based tracelistener which uses a booleanswitch (enable/disable), a general traceswitch (set the tracelevel) and a userspecific traceswitch (set the tracelevel for a...
0
by: emy | last post by:
hello and hye everyone... can i know whether a .dll can read from traceswitch configuration file.I tried for windows application and it work well..because as far as i read, class...
2
by: nhmark64 | last post by:
Hi, When i run testapp.exe the testapp.exe.config file i have in the DEBUG directory gets deleted, and the TraceSwitch in my code never gets set. testapp.exe.config ____________________...
2
by: PMac | last post by:
I'm trying to execute a stand-alone console application from an aspx page when a use clicks a button on that page. On the aspx page is the following lines of pertinent code: private void...
1
by: David | last post by:
I am attempting to use "TraceSwitch " in Win Forms (Below is the code and the app.config). According to the manual, the program should read the config for the setting, but this is not occurring....
13
by: Khodr | last post by:
Hello, I am using VS.NET 2003 and vb. I build my application MyApp and it generates MyApp.exe.config. So now MyApp.exe reads parameters from MyApp.exe.config. Great and no problem! I need to...
0
by: PhilipDaniels | last post by:
I'm trying to create a tracing system for my application. I want to create a new type of Switch that is basically TraceSwitch with an extra attribute called "includeMethodName". So my application's...
3
by: Blasting Cap | last post by:
I am working on a web app that I want to be able to use a separate config file on, in addition to the web.config file that's already working in the application. If I put the following in the...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 =...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.