Header for entire log file

Topics: Logging Application Block
Aug 31, 2011 at 3:29 PM


We have a case where i created a custom ILogFormatter which formats my log data such that it supports a CSV file format.  So i have it working so that the file can properly be imported by any tool that supports CSV Files (like Excel).

The problem is that i want to put the headers on the first row of the file (not for each entry).  But i'm struggling to find how to do that, beacuse the Header property in the listeners section is for each entry and not the entire file.   I was hoping that maybe i could somehow implement a custom listener to accomplish this but not finding much information out there that would suggest this is possible.

Does anyone have any ideas or suggestions to accomplis this?


Sep 1, 2011 at 6:55 AM


The easiest way I can think of is to write a code that will directly modify the file and add the necessary header. The other way is to create a custom trace listener, copying the functionality of flat file trace listener and modify the part that appends the header. My idea here is to check first if the file has any contents before adding the it.


Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us