Logging the method name?

Topics: Logging Application Block
Sep 30, 2008 at 4:40 PM
Hi! Is there a way to log the method name when logging with the Logger.Write() inside a method? I have the solution when using LAB with Policy Injection: property(TypeName)}.{property(MethodName)}({dictionary({key} - {value})}). But i can't find anything on how to do this with the Logger. .lina
Oct 9, 2008 at 11:47 AM
Edited Oct 9, 2008 at 11:53 AM

you can try something like this.


LogEntry log = new LogEntry();

log.EventId = 300;

log.Message = "Sample";


 log.Categories.Add("UI Events");

 log.Severity =



 log.Priority = 5;

log.ExtendedProperties =

new Dictionary<string, object>();



new KeyValuePair<string,object>("Method", System.Reflection.MethodInfo.GetCurrentMethod().Name));








Oct 9, 2008 at 1:34 PM
Edited Oct 9, 2008 at 1:34 PM
Thank you Kratos!.lina