5

I am using log4net for logging. Is there any straightforward way to parse result files?

Peter17
  • 3,052
  • 9
  • 47
  • 77

4 Answers4

6

Why not save log entries to CSV or XML in the first place?

Community
  • 1
  • 1
Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
  • If log4net supports these formats this could be the way. I don't have any experience in logging. I want to have a readable log file and be able to open it from the software as well. – Peter17 Jun 06 '11 at 09:36
  • 1
    Additionally, CSV has the advantage, that you can easily use the [Microsoft Log Parser](http://www.microsoft.com/downloads/en/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en), either as Tool or COM-Component, to parse the logs with an SQL like syntax - quite powerful. – Christian.K Jun 06 '11 at 10:13
4

You have full control of the output log file in terms of layout and fields so you can specify one format you can then parse afterwards.

in general my approach is to have a human readable syntax in the log file and to use another appender enabled as well to store in the database information I can then query later, having everything in the db is handy because it's easy to query and comes "already" formatted with no need to parse it manually...

Davide Piras
  • 43,984
  • 10
  • 98
  • 147
2

Log4View is a useful tool in these kinds of situations.

Colin Desmond
  • 4,824
  • 4
  • 46
  • 67
1

JSON

Hi, my log4net.Ext.Json is now ready for testing. You can use it with nxlog's xm_json parse_json() or with logstash. I think JSON offers a good compromise between humans and machines with regards to readability and volume. I'm pouring it all into elasticsearch then and view with kibana.

Robert Cutajar
  • 3,181
  • 1
  • 30
  • 42