You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2017/09/15 17:17:00 UTC

[jira] [Comment Edited] (LOG4J2-2052) Disable thread name caching by default

    [ https://issues.apache.org/jira/browse/LOG4J2-2052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16168210#comment-16168210 ] 

Remko Popma edited comment on LOG4J2-2052 at 9/15/17 5:16 PM:
--------------------------------------------------------------

I wasn't aware of that fix. We could try to detect the Java version that Log4j2 is running on and adjust the default to UNCACHED on Java 8u102 or higher, while staying on CACHED on Java 8u101 or earlier. (There are ~20 [Java 8 update versions|https://en.wikipedia.org/wiki/Java_version_history#Java_8_updates] before this change so we'd have to look at minor version also.)


was (Author: remkop@yahoo.com):
I wasn't aware of that fix. We could try to detect the Java version that Log4j2 is running on and adjust the default to UNCACHED on Java 8u102 or higher, while staying on CACHED on Java 8u101 or earlier. (There are ~20 Java 8 versions before this change so we'd have to look at minor version also.)

> Disable thread name caching by default
> --------------------------------------
>
>                 Key: LOG4J2-2052
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2052
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Dan Berindei
>            Priority: Minor
>
> We run our tests in parallel with TestNG and we use {{Thread.setName()}} for easy filtering of log messages from a single test. But since LOG4J2-1334, all the thread names are logged as {{TestNG}}, unless we use {{-DAsyncLogger.ThreadNameStrategy=UNCACHED}}.
> JDK 8u102 removed the {{String}} allocation in {{Thread.getName()}} (https://bugs.openjdk.java.net/browse/JDK-8148842), so I suggest changing the default strategy to {{UNCACHED}}. Users of older JDKs will still be able to use {{-DAsyncLogger.ThreadNameStrategy=CACHED}} for the performance improvement.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)