Skip to content
Csaba Nemes edited this page Jan 31, 2019 · 4 revisions

Log4Net patterns

The Tracer.Log4NetFody adapter will generate messages that looks like

Entered into MethodName(int, string) (input=42, inpStr=Hello).
Returned from MethodName(int, string) ($return=Bye). Time taken 12s.

If you wish to log method name, arguments or the time taken differently you can use the built-in patterns like %method and custom ones like

  • %property{trace} for the trace type ENTER or LEAVE
  • %property{arguments} for the arguments and return values
  • %property{timeTaken} for the time spent in the method
  • %property{startTicks} for the raw start Ticks value
  • %property{endTicks} for the raw end Ticks value

Please note that compared to the original log4Net way of working using %method does not incur any performance penalty as the location is calculated at rewrite time.

Please also note that compared to the original log4Net the stackframe information is not available due to the way how the rewriter works. Method and class information is compiled/written directly into the call sites, so there is no need for the costly build up of the stackframes.

Clone this wiki locally