more G-Labs products

Author Topic: CSV logfile  (Read 864 times)

December 22, 2015, 04:01:17 PM
Read 864 times

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Should we make the logfile field separator a comma since it is a CSV file?  If it were proper CSV file it would load directly into excel without having to split text to columns.  Empty lines are problematic for data filter too.

December 22, 2015, 04:06:01 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Not sure if that works since some of the output of logs includes debug data which both could include commas as well as multi-line.  I would prefer csv, but I don't think it's as easy as changing the separator from space to comma.

December 22, 2015, 05:44:38 PM
Reply #2

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Do not use the space char as the seperator. The separator is the [Tab] character "\t".
There's actually an issue with the timestamp that will result merged to the log level and the event source.
This issue can be fixed by adjusting the NLog.config file to have the "\t" separator as well:
https://github.com/NLog/NLog/wiki/CsvLayout
All other fields will be splitted consistently.

Cheers,
g.

December 22, 2015, 06:14:37 PM
Reply #3

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
If comma is needed in a field, the field can be surrounded by double quote to allow comma (for excel anyway).