Upgrade 3.1 -> 4.0 Problem with log template

Topics: Logging Application Block
Mar 30, 2009 at 3:18 PM
Hello everyone,

I have the following problem: we had a project which worked somehow with Enterprise Library 3.1. Having made an upgarde to 4.0 a log template functionality does not seem to work. 
We have the following attribute before a function to log the function call:

      [LogCallHandler(Categories = new string[] {"Trace" }, LogBeforeCall = true, 
        BeforeMessage = "START {property(TypeName)}.{property(MethodName)}({dictionary({key}={value})})",
        LogAfterCall = true, 
      AfterMessage = "END {property(TypeName)}.{property(MethodName)}()", 
      IncludeParameters = true, Severity = TraceEventType.Verbose, Order = 1)]

The template for {property(TypeName)}, {property(MethodName)}  does not really work, because we got the following result: 

    ----------------------------------------
    Timestamp: 2009.03.25. 13:08:14
    Message: START {property(TypeName)}.{property(MethodName)}({dictionary({key}={value})})
    Category: Trace
    Severity: Verbose
    Title:Call Logging
    ----------------------------------------

I have checked the doucentation and the syntax for {property(TypeName)} templates did not change. Has someone idea why do I get despite only the template syntax wihtout information??

Thanks for the ideas and help.

Regards,
 Daniel
Apr 1, 2009 at 11:03 AM
Edited Apr 1, 2009 at 12:35 PM
Hi,
     I was able to repro your case.  I tried those tokens both in the 4.1 and 4.0 version and got them to work when used in the formatter template.  They won't only work when used in the BeforeMessage and AfterMessage property.  I'll check the tracker if this has already been added.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com
Apr 2, 2009 at 1:49 PM

Hy Sarah,

Thanks for the response, I am just suprised, because with 3.1 it was working correctly

3.1 enterprise library same code:

[

LogCallHandler(Categories = new string[] { "Trace" }, LogBeforeCall = true,
BeforeMessage =
"START {property(TypeName)}.{property(MethodName)}({dictionary({key}={value})})",
LogAfterCall =
true,
IncludeCallTime =
true,
AfterMessage =
"END {property(TypeName)}.{property(MethodName)}()",
IncludeParameters =
true, Severity = TraceEventType.Verbose)]

But the log looks perfects:

----------------------------------------
Timestamp: 2009.03.19. 16:38:47
Message: START Ab.Uni.Feta.UB.BusinessLogic.Managers.UserManager.GetCurrentUserData()
Category: Trace
Severity: Verbose
Title:Call Logging
----------------------------------------
----------------------------------------
Timestamp: 2009.03.19. 16:38:47
Message: END Ab.Uni.Feta.UB.BusinessLogic.Managers.UserManager.GetCurrentUserData()
Category: Trace
Severity: Verbose
Title:Call Logging
----------------------------------------

Does it actually depend on the template? Or on the template and reflection somehow?

Regards,

 Daniel

 

Mar 17, 2010 at 3:16 PM

Do you know if this functionality will be returned in 5.0? I am using beta 2 and it is not yet working. I know there is mention of many bug fixes still to come, I hope this is one of them.

Mar 18, 2010 at 8:50 AM

Hi,

We dont know if that functionality will be returned. We'll ask the Ent lib team for this and get back to you.

Valiant Dudan
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com