Groups | Blog | Home
all groups > dotnet web services > march 2006 >

dotnet web services : compiling webservice using csc.exe


Nadagouda
3/9/2006 8:42:43 AM
if i build using visual studio no problem everything works great.

if i use csc.exe to compile webservice, and everything works fine. except
writing to log.

i have some code in global.asax and also trace entire webservice which
writes to the log

global.asax

Trace.AutoFlush = true;
StringBuilder strbTemp = new
StringBuilder("****************************************************" +
Environment.NewLine + "[" + AppDomain.GetCurrentThreadId() + "]");
strbTemp.Append(" " + startTime.ToString("M/d/yyyy HH:mm:ss.fff") + " : ");
strbTemp.Append("Tets40 version ");
strbTemp.Append(Test40.m_WSVersion);
strbTemp.Append(" initialization start.");
Trace.WriteLineIf( Simulator40.m_traceMonitorSwitch.TraceVerbose,
strbTemp.ToString() );

web.config
<system.diagnostics>
<switches>
<!--Trace Switch Values:
0 Off: No tracing
1 Error: Trace errors only
2 Warning: Trace errors and warnings
3 Info: Trace errors, warnings, and informational events
4 Verbose: Trace everything -->

<add name="TraceMonitorSwitch" value="4" />
</switches>
<trace autoflush="true" indentsize="0">
<listeners>
<add name="ApplicationLogFile"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="D:\Test40\log\Test40.log" />
</listeners>
</trace>
</system.diagnostics>
I donno whats going on here ? the log is not being written but entire
functionality works fine.

please let me know.

thanks
Josh Twist
3/9/2006 10:29:17 AM
As mentioned here:
http://www.thejoyofcode.com/DebugView_from_sysinternals.aspx, you need
to use the /d:TRACE switch with csc.exe otherwise the calls to
System.Diagnostics.Trace aren't compiled into your code.

They're decorated with the [Conditional("TRACE")] attribute.

Josh
http://www.thejoyofcode.com/
AddThis Social Bookmark Button