« Previous Next »

Thread: How to view the log that is written to standard output

Last post 01-13-2009 5:50 PM by clinkmeister. 6 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (7 items)

Sort Posts:

  • 01-13-2009, 10:15 AM

    How to view the log that is written to standard output

    Hi,

    I am new to IIS. We have deployed a web-service written in C++ to IIS that is working fine but I would like to view the logging information that is being written to standard-ouput in the C++ code. I couldn't locate any files under IIS root that had this logging information. Is there anything I need to do to enable the capture of what is written to standard-output?

    Thanks.

     

  • 01-13-2009, 10:37 AM In reply to

    Re: How to view the log that is written to standard output

    I don't know about standard output, but if you do a call to OutputDebugString(), it will output it, even in release mode, and you can view it using DebugView from SysInternals.
    The Clinkmeister
  • 01-13-2009, 10:55 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 10:27 AM
    • Central NJ
    • Posts 6,174
    • IIS MVPs

    Re: How to view the log that is written to standard output

  • 01-13-2009, 1:32 PM In reply to

    Re: How to view the log that is written to standard output

    clinkmeister,

    Thanks for you help. That worked.

    Ideally, I would like all that is written to std-out to go to a log file. Is this possible?

     

  • 01-13-2009, 1:36 PM In reply to

    Re: How to view the log that is written to standard output

    Tom,

    I am not sure what you mean by 'you need to handle that in your code'.

    Are you saying that instead of writing to std-out I need to write to a log-file myself?

     

  • 01-13-2009, 4:14 PM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 10:27 AM
    • Central NJ
    • Posts 6,174
    • IIS MVPs

    Re: How to view the log that is written to standard output

  • 01-13-2009, 5:50 PM In reply to

    Re: How to view the log that is written to standard output

    I agree that creating some log routines to handle writing to a log file (or using the Application Event Log -- or custom event log (not sure how they work yet)) would be better than trying to redirect std-out, or using OutputDebugString. You may want a more flexible log function similar to sprintf that takes a variable number of arguments. If you analyze sprintf or .Format, one of them will show you how that works, and you can simply replace the printf and puts with your own logging function that takes a format string and variable number of arguments and writes to your own text file / event log. You will probably have to serialize the output to the file with a critical section / lock. Thus you will want to have logging as optional configuration. Ensure that account running the web service (local system / local service / specific service account / or riding on user credential) has access to write / create the log file in the directory you are writing to.
    The Clinkmeister
Page 1 of 1 (7 items)
Microsoft Communities