Performance of PatternLayout

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Performance of PatternLayout

Martin Kozubek
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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance of PatternLayout

Dominik Psenner
I dont have the issue number at hand, but this story sounds familiar and there should be one filed on jira. If you have valuable information to add, (ideally a patch) please use the search function to find the issue.

On 7 Feb 2017 9:02 a.m., "Martin Kozubek" <[hidden email]> wrote:
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


Loading...