setting TypeName and MethodName

Topics: Logging Application Block
Apr 27, 2007 at 4:58 PM
How can I set these properties myself? When i make a call to Logger.Write() log message has "<Error: property TypeName not found>::<Error: property MethodName not found>" in it.

Thanks,
-Justin
Apr 27, 2007 at 5:06 PM
Hi Justin -

I presume you're talking about the properties in the TraceLogEntry which is used by the PIAB LogCallHandler. You can use this class in other contexts if you want, but most of the Logger overloads are hard-wired to use the plain-vanilla LogEntry. Instead you'll need to new up a TraceLogEntry, set its properties and pass it to the Logger.Write(LogEntry entry) overload.

Tom
Apr 27, 2007 at 10:04 PM
Thanks for the repsonse Tom. I see what your saying and i have implemented the change. I'm seeing some real funky behavior in my log file however. I have a single Category set up in my LAB named (General) That catagory has a single Rolling File Trace Listener. The Trace Listener is configured to use a TextFormatter that i've set up to print information in a particular format read by our trace file display tool.

I have a Logging Handler set up for the PIAB and it works great I see the before and after trace messages for all my method calls. Now I've added a Logger.Write() call that gets invoked between the Before and After trace messages. When I step through the LogSource::TraceData method I see the Logger.Write() data I expect get written to the log file when listener.Flush() is invoked. BUT when the "After" trace message gets wrtten to the file it actually overwrites part of the message just outputted by the Logger.Write() call.

Can anyone else repro this problem? Or have I done something wrong.

Thanks,
Justin
Apr 27, 2007 at 11:06 PM
Hi Justin -

Any chance you could package together a simple repro and send it to us for investigation?

Tom
Apr 30, 2007 at 4:38 PM
Tom,

I have a simple solution that repro's the problem. How can I get that to you?

-Justin
Apr 30, 2007 at 5:46 PM
Mail to tomholl at microsoft.com.