compiling webservice using csc.exe

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nadagouda

    compiling webservice using csc.exe

    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.New Line + "[" + AppDomain.GetCu rrentThreadId() + "]");
    strbTemp.Append (" " + startTime.ToStr ing("M/d/yyyy HH:mm:ss.fff") + " : ");
    strbTemp.Append ("Tets40 version ");
    strbTemp.Append (Test40.m_WSVer sion);
    strbTemp.Append (" initialization start.");
    Trace.WriteLine If( Simulator40.m_t raceMonitorSwit ch.TraceVerbose ,
    strbTemp.ToStri ng() );

    web.config
    <system.diagnos tics>
    <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="TraceMoni torSwitch" value="4" />
    </switches>
    <trace autoflush="true " indentsize="0">
    <listeners>
    <add name="Applicati onLogFile"
    type="System.Di agnostics.TextW riterTraceListe ner"
    initializeData= "D:\Test40\log\ Test40.log" />
    </listeners>
    </trace>
    </system.diagnost ics>
    I donno whats going on here ? the log is not being written but entire
    functionality works fine.

    please let me know.

    thanks
    Gouda
  • Josh Twist

    #2
    Re: compiling webservice using csc.exe

    As mentioned here:
    http://www.thejoyofcode.com/DebugVie...internals.aspx, you need
    to use the /d:TRACE switch with csc.exe otherwise the calls to
    System.Diagnost ics.Trace aren't compiled into your code.

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

    Josh


    Comment

    Working...