Hello,
I have noticed performance hit after adding a custom property and using
a PatternConverter to render it. It's the same for any context
property(global,thread,event). If there is a %property{smthing} in
PatternConverter's string, the logging process results into call of
Principal.WindowsIdentity.GetCurrent().Name.
The code containing this call is in the LoggingEvent class. It is getter
of property UserName. Since log4net v 1.2.12 the
LoggingEvent.CreateCompositeProperties() is getting this property. The
problem is that this method is called once for logging event whenever
there is some %property{} to be rendered.
This results in that even if I don't use the username, but I add and use
some custom property in the event, the logging process is ~10 times slower.
I can solve it by programming my own layout instead of PatternLayout,
but I am wondering if is it an expected behavior. Should that be
reported to developers?
MK
- Performance of PatternLayout Martin Kozubek
-