How to create a Log file using c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meettapan
    New Member
    • Jun 2007
    • 9

    How to create a Log file using c#

    I want to create the log file as below:-

    2007/03/09 19:12:08 : ~extasc_cdr_200 61230.csv.vcdr
    2007/03/09 19:23:02 : ~extasc_cdr_200 61230.csv.vcdr
    2007/03/09 19:42:13 : ~extasc_cdr_200 61230.csv.vcdr
    File ID : 10241
    Input records : 72
    Rated records : 3
    Database records : 3
    Zero amount records: 0
    Rated duration : 1601 seconds (00:26:41)
    Rated amount : 6.670000
    Error records : 69

    Error statistics:
    Count Error
    -------------------------------------------------------
    9 : (04) Service not active on calldate
    52 : (08) Destination not found in tariff zones
    8 : (09) No valid time zone / price found for calldate

    2007/03/09 19:42:14 : ~extasc_cdr_200 61231.csv.vcdr
    File ID : 10242
    Input records : 38
    Rated records : 2
    Database records : 2
    Zero amount records: 0
    Rated duration : 44 seconds (00:00:44)
    Rated amount : 1.448260
    Error records : 36

    Error statistics:
    Count Error
    -------------------------------------------------------
    6 : (04) Service not active on calldate
    24 : (08) Destination not found in tariff zones
    6 : (09) No valid time zone / price found for calldate

    2007/03/09 19:42:14 : ~extasc_cdr_200 70101.csv.vcdr
    File ID : 10243
    Input records : 51
    Rated records : 5
    Database records : 5
    Zero amount records: 0
    Rated duration : 1819 seconds (00:30:19)
    Rated amount : 6.748592
    Error records : 46

    Error statistics:
    Count Error
    -------------------------------------------------------
    4 : (04) Service not active on calldate
    38 : (08) Destination not found in tariff zones
    4 : (09) No valid time zone / price found for calldate

    with regards
    Tapan
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by meettapan
    I want to create the log file as below:-
    ...
    with regards
    Tapan
    Hi Tapan :)
    Your question is very vague...I need more information about the problem you are trying to solve before I can really help you.

    What language are you using?
    When are these errors occurring?
    What have you tried so far to create this log file?

    It seems to me that whenever you catch an exception or determine than an error has occurred that you just want to output that information into a text file. Have you tried this yourself first already?

    Where did you get the log file information from that you've posted in your question?

    Thanks,

    -Frinny

    Comment

    • meettapan
      New Member
      • Jun 2007
      • 9

      #3
      Hello,

      I am using c#.NET to develope this.
      In my project I am converting the .csv files to .vcdr format using Altova XML Processor.

      My objective is to write the log files as given before( as example )if any error occured. Even if any error don't happen then also it writes to the log file about its successfully process.

      The above log files are happening from my existing project(Used in borland c++ by other programmers), I have to do the same by using C#.NET (C-Sharp .NET) .

      So please give me the code how to create a log file.
      Even you still don't understand my proble,please don't hesitate to reply me.Once again i can explain you, please its urgent...

      With Regards
      Tapan

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by meettapan
        Hello,

        I am using c#.NET to develope this.
        In my project I am converting the .csv files to .vcdr format using Altova XML Processor.

        My objective is to write the log files as given before( as example )if any error occured. Even if any error don't happen then also it writes to the log file about its successfully process.

        The above log files are happening from my existing project(Used in borland c++ by other programmers), I have to do the same by using C#.NET (C-Sharp .NET) .

        So please give me the code how to create a log file.
        Even you still don't understand my proble,please don't hesitate to reply me.Once again i can explain you, please its urgent...

        With Regards
        Tapan
        In your code, whenever you process something or whenever an error happens all you have to do is append it to your log file.

        Have you seen MSDN's article on How to: Write Text to a File?

        -Frinny

        Comment

        Working...