How to log Console.WriteLine output

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?RGFtaXIgRGV6ZWxqaW4=?=

    How to log Console.WriteLine output

    Hi.

    I'm new to VS.NET 2008 and WCF development (.NET 3.5).
    I'm developing a WebService prototype. I would like to use Console.WriteLi ne
    (or similar) to log some information I need for future development /
    troubleshooting . Unfortunately I didn't figure out the way to log the output
    to a file.

    I spent few hours studying and trying out the web.config ->
    system.diagnost ics, but I figured out it is not meant to be used for what I'm
    looking for - maybe I'm mislead and I just don't know how to use it.
    I also found Apache Log4Net that is supposed to address my needs; however, I
    would like to avoid using a 3rd party library just for simple logging - there
    should be a simple way to do it in .NET.

    Can someone point me to the solution? :)

    Thanks,
    Damir Dezeljin
  • Mr. Arnold

    #2
    Re: How to log Console.WriteLi ne output


    "Damir Dezeljin" <Dezo@noemail.n oemailwrote in message
    news:18FF22C5-AA33-4AEB-ACEE-06F446601F89@mi crosoft.com...
    Hi.
    >
    I'm new to VS.NET 2008 and WCF development (.NET 3.5).
    I'm developing a WebService prototype. I would like to use
    Console.WriteLi ne
    (or similar) to log some information I need for future development /
    troubleshooting . Unfortunately I didn't figure out the way to log the
    output
    to a file.
    >
    I spent few hours studying and trying out the web.config ->
    system.diagnost ics, but I figured out it is not meant to be used for what
    I'm
    looking for - maybe I'm mislead and I just don't know how to use it.
    I also found Apache Log4Net that is supposed to address my needs; however,
    I
    would like to avoid using a 3rd party library just for simple logging -
    there
    should be a simple way to do it in .NET.
    >
    Can someone point me to the solution? :)
    You can just use the eventlog, by creating it on the fly and then using it.
    The eventlog which should be created as an Application Eventlog on a NT
    based O/S can be viewed with the Event viewer on another machine across the
    LAN. I have done this with Console and NT Service application, and I don't
    see why you couldn't do it with a WCF solution.

    The example is in VB.Net but you can do the same thing in C#.Net



    Comment

    • =?Utf-8?B?RGFtaXIgRGV6ZWxqaW4=?=

      #3
      Re: How to log Console.WriteLi ne output

      Thanks Arnold.

      Anyway ... EventLogging isn't really what I'm looking for. Well, it can be
      used as a first solution; however, I'm still looking for a solution to easily
      log to files like e.g. I do by using log4j with Axis2 web services.

      Any other hint? Or at least can someone tell me if it is at least possible
      do it in .NET C#?

      Sincerely,
      Damir

      Comment

      • Mr. Arnold

        #4
        Re: How to log Console.WriteLi ne output


        "Damir Dezeljin" <Dezo@noemail.n oemailwrote in message
        news:0681350C-B650-4D14-8C04-588A782D89E7@mi crosoft.com...
        Thanks Arnold.
        >
        Anyway ... EventLogging isn't really what I'm looking for. Well, it can be
        used as a first solution; however, I'm still looking for a solution to
        easily
        log to files like e.g. I do by using log4j with Axis2 web services.
        >
        Any other hint? Or at least can someone tell me if it is at least possible
        do it in .NET C#?
        Doesn't Application Blocks for .Net have a logging functionality, use Google
        look it up?

        Comment

        Working...