[
https://issues.apache.org/jira/browse/LOG4J2-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17514949#comment-17514949
]
Romain Manni-Bucau commented on LOG4J2-2795:
--------------------------------------------
To give another metrics for my computer: a real "small" application (johnzon +
cdi + yupiik-logging/JUL) starts in ~250ms (with scanning not optimized and
some startup init code) which is 30ms faster than log4j alone for a
getLogger().info() main - just enables to compare why I speak about a few
dozens of ms to init the logging.
Wonder if you evaluated to not collect plugins but just try to load them lazily
when they are referenced. Concretely, ConsoleAppender wouldnt be loaded until
it appears in some configuration etc...Also loading it using a registrar class
(kind of ServiceLoader mecanism but with a name deduced from the name
encoutered by log4j) can enable to simplify the serialization too and get back
to something closer to the previous (v1) configuration where it was loaded per
class directly (even if it still has an indirection with the resource lookup
but it is a bit better).
That + dropping most of static init would be great I think even if I can't
evaluate the gain yet.
> 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)