Logging to Rolling File and formatting output

Topics: Logging Application Block
Nov 15, 2010 at 3:45 PM

I have searched for this for awhile and now I am wondering if I am the first to try this (yikes).

I am trying to output the timestamp, severity, and message to a rolling flat file.  So far this all works.  the problem I am having is the log file should be more "readable".  so one of the requirements is now to have more of a fixed with display in the log file.  Is there a way to force each token to a certain character width.  The {tab} doesnt quite work as I was hoping.  here is my current formatter template:

{timestamp(local:F)}{tab}{severity}{tab}{message}

Example (before):

Monday, November 15, 2010 10:40:13 AM Information *** Beginning Export From  VSA Source to Blackboard Snapshot ***
Monday, November 15, 2010 10:40:13 AM Error *** FAKE ERROR: Beginning Export From  VSA Source to Blackboard Snapshot ***
Monday, November 15, 2010 10:40:13 AM Information Received 1588 Classroom objects.
Monday, November 15, 2010 10:40:13 AM Information Received 0 Observer objects.

(desired)

Monday, November 15, 2010 10:40:13 AM      Information       *** Beginning Export From  VSA Source to Blackboard Snapshot ***
Monday, November 15, 2010 10:40:13 AM      Error                *** FAKE ERROR: Beginning Export From  VSA Source to Blackboard Snapshot ***
Monday, November 15, 2010 10:40:13 AM      Information       Received 1588 Classroom objects.
Monday, November 15, 2010 10:40:13 AM      Information       Received 0 Observer objects.

 

I really just need to say that the severity field should be 15 or 20 characters wide.  any ideas?

 

Thanks in advance!!!

Derek

Nov 16, 2010 at 11:10 PM
Edited Nov 17, 2010 at 12:36 AM

That is not supported.  Won't adding, say 2 or 3 {tab} tokens, do the trick?

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@Avanade.com