Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I am using trace for my website.

Before I was using trace for webapplication. That trace was working fine. Now i converted to website. Wherever i have written trace compiler is not calling that function. During run time i am using immediate window and i copied the same trace line and executed it is working. Please give me solution why compiler is not calling trace? My code is

C#
TraceSwitch Switch;
Switch = new TraceSwitch("SwitchName", "Switch Trace");
System.Diagnostics.Trace.WriteIf(Switch.TraceInfo, "My message", "Info");
Posted
Updated 22-May-12 18:42pm
v4
Comments
BobJanova 22-May-12 6:58am    
Where are you looking? I think stdout for web apps ends up in a log file somewhere, but it might just get swallowed if you don't set up logging.
Ed Nutting 22-May-12 15:46pm    
I think you're right - everything I've ever done has gone straight to the log files unless I set some other output file/stream.

Hi
Try class Logging in project

MP3-Rearrange

I use it in aspx and windows apps.

Good luck

John
 
Share this answer
 
Comments
Member 7684075 23-May-12 0:45am    
Tnk you John. But I am saving the trace details in DB. For that i have created table and everything working fine wen my application was WebApplication. But now i changed to website. So even writelineif also not calling during running time. My question is why the compiler is not exeucting this trace line?
John Orendt 23-May-12 4:59am    
In class Logging override
public virtual void WriteLog(String plog)

to do database insert.

Test that insert code works on both WebApplication and website.

Also, verify that debug mode is used in both WebApplication and website.

class Logging does not output messages in Release mode. However, you can comment out StopLogging(); statement towards the bottom of method StartLogging()
hi fried:
now i need know the principle of tracing! in fact ,i am coding a codeeditor and i want to know some about tracing! hope you can give me some ideas! thank you !
 
Share this answer
 
Comments
Ron Beyer 19-Nov-13 0:03am    
Please don't dig up other peoples questions to ask your own, you have two active questions just use them, somebody will get to you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900