How to log MethodName when wrapping Log4net?

后端 未结 10 1702
说谎
说谎 2020-11-29 23:41

I have wrapped Log4net in a static wrapper and want to log

loggingEvent.LocationInformation.MethodName
loggingEvent.LocationInformation.ClassName
         


        
10条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 00:30

    What about the %M and %C variables? http://logging.apache.org/log4net/log4net-1.2.11/release/sdk/log4net.Layout.PatternLayout.html

    Usage, something like:

    
      
    
    

    Doesn't that do what you are after?

提交回复
热议问题