Trace from a service running in web application

H

H Branyan

In the Application_OnStart event in global.asax, my code calls an
AlertService which creates a System.Timers.Timer() object. So this service
doesn't actually run in conjunction with a specific aspx page, apparently.
When the timer's Elapsed event handler fires, it calls some other classes I
have written. These classes output some Trace statements that you can view
if an aspx page calls them, but I can't seem to figure out where the Trace
statements go when my service calls the classes.

Is there any way I can find the trace for this service?
 
H

H Branyan

Doing some research, I've come across the System.Diagnostics tools. I have
set up my application to write to a textfile, c:\listener.log, but while the
file was automatically created, I am not able to write to the file.

code...

web.config:

<system.diagnostics>
<switches>
<add name="tracewebforms" value="1" />
<add name="tracebusinesslogic" value="1" />
</switches>
<trace autoflush="true" >
<listeners>
<add name="ImplicitListener"
type="System.Diagnostics.TextWriterTraceListener, System,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="c:\TraceListener.log"/>
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>

<compilation defaultLanguage="c#" debug="true">
<compilers>
<compiler
language="C#;Csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=1.0.3300.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
compilerOptions="/d:TRACE" />
</compilers>
</compilation>

Page_load event of webform:

System.Diagnostics.Trace.WriteLineIf(Global.webformsSwitch.Enabled,"Trace
From WebForms");


What could prevent the WriteLineIf from actually writing to the file?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top