473,326 Members | 2,076 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,326 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 4478
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: 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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.