.NET Single Line Logging (ala Trace.Write/WriteLine) using Instrumentation.Logging

Posted by KnownColor on Stack Overflow See other posts from Stack Overflow or by KnownColor
Published on 2009-06-03T16:03:06Z Indexed on 2010/06/18 12:03 UTC
Read the original article Hit count: 327

Filed under:
|
|
|

Hello Everyone,

My question is whether it is possible to get line/multiline (very unsure of correct term for this) behaviour of the Trace.Write and Trace.WriteLine methods but using the Microsoft Instrumentation Logging framework in .NET 2.0.

Desired Output

Hello World!
Oh Hai.

What I Currently Have

Trace.Write("Hello ");
Trace.WriteLine("World!");
Trace.Write("Oh Hai.");

I would prefer to use instrumentation to log rather than writing to a log file using Debug.Trace.

EDIT: By Instrumentation Logging I mean using a 'loggingConfiguration' block in my App.config and writing Log Entries using using Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry logEntry);

Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0 for example.

Ta, KnownColor

© Stack Overflow or respective owner

Related posts about .NET

Related posts about logging