logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (LOG4J2-1029) Performance improvement when gathering Location Information
Date Mon, 26 Oct 2015 05:20:27 GMT

     [ https://issues.apache.org/jira/browse/LOG4J2-1029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Remko Popma reassigned LOG4J2-1029:
-----------------------------------

    Assignee: Remko Popma

> Performance improvement when gathering Location Information
> -----------------------------------------------------------
>
>                 Key: LOG4J2-1029
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1029
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.3
>         Environment: Java 1.8.0_45 64-bit
> Maven 3.3.1
> Windows 7
> basically any...
>            Reporter: Stefan Leonhartsberger
>            Assignee: Remko Popma
>            Priority: Minor
>              Labels: Performance
>             Fix For: 2.5
>
>
> When gathering Location Information in Log4jLogEvent 
> Log4j uses *Thread.currentThread().getStackTrace()*
> Using *(new Throwable()).getStackTrace();* would be more performant especially for larger
stacks according to various benchmarks: 
> * http://alexradzin.blogspot.co.at/2011/12/how-slow-getstacktrace-is.html
> * http://stackoverflow.com/questions/2347828/how-expensive-is-thread-getstacktrace
> This can easily be verified with a simple JMH Benchmark test.
> What would help in addition is to skip the Log4j Part when iterating over the StackTrace
- use i=4 or whatever you may consider as being save enough instead of starting with i=0.

> Basically something like:
> {code}
> final StackTraceElement[] stackTrace = (new Throwable()).getStackTrace();
> for (int i = 4; i < stackTrace.length; i++) {
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message