Fixed width & class name formatting for TextFormatter?

Topics: Logging Application Block
Apr 11, 2012 at 11:36 AM

I'm trying to switch from log4net over to MSEL for logging and I'm having difficulty just getting the same format for single line log entries as I had with log4net.

e.g. in log4net I can use a "PatternLayout" string of "%-5p %d %-24.24c{1} - %m%n" which outputs lines like this:

DEBUG 2012-03-08 10:48:32,481 MyClassName             - This is my log message text
INFO  2012-03-08 10:48:32,484 MyOtherClassName        - Another log message

Note that the severity and classname fields are using fixed width formatting.

Using the MSEL TextFormatter the closest I can get so far is:

{severity} {timestamp(dd/MM/yyyy HH:mm:ss.fff)} {message}

Does anyone know:

1) Is there a way to get fixed width output of tokens to keep the logs neat?

2) Is there a supported token that will give me the class name?  (if not I will have to add it myself in my own logging facade).

Thanks for looking.