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

Matt Sicker commented on LOG4J2-2795:
-------------------------------------

Ah, I was also having that issue in Java 17. It seems like using MethodHandles 
instead of reflection doesn't work so well on non-public things there. Could 
also be a bug elsewhere. I think I may need to keep the reflection-based 
approach as a backup there.

I did start working last night on centralizing creation of PluginManager 
classes into Injector to avoid repeated work, though I haven't committed that 
yet.

If you profile this, do you see any interesting code paths that might be 
contributing to the slow start? It's quite possible that the hostname lookup 
thing is what's causing the bulk of that startup time (which is something I 
noticed long ago in unit tests if you didn't have an entry in /etc/hosts for 
your localhost domain name as the lookup is forced to find out via DNS instead 
which takes time). A simple way to verify this might be to ensure your 
/etc/hosts file has an entry for 127.0.0.1 (and optionally one or more for your 
actual network interface, though I don't think that's as relevant here) and see 
how that affects the startup time.

> Make LogManager/LoggerContext creation time reasonable
> ------------------------------------------------------
>
>                 Key: LOG4J2-2795
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2795
>             Project: Log4j 2
>          Issue Type: Task
>          Components: Core
>    Affects Versions: 2.13.0
>            Reporter: Romain Manni-Bucau
>            Priority: Major
>         Attachments: image-2020-03-06-08-58-21-169.png, log4j2.png
>
>
> Currently (2.13), LogManager.getLogger("xxx") takes ~600ms on a cold JVM by 
> itself.
> For a logging framework it is likely way too much (by comparison a CDI test 
> with classpath scanning takes ~50ms).
>  
> This ticket is about trying to be faster (maybe by removing java 
> serialization usage and reducing registry usage + reflection of plugins by 
> generating java code?).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to