[
https://issues.apache.org/jira/browse/LOG4J2-565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13933144#comment-13933144
]
Remko Popma commented on LOG4J2-565:
------------------------------------
It looks like you unzipped the log4j api and core jars and zipped the contents
back into your {{/var/media/AppJar.jar}} jar file. If this file is very large,
log4j startup will be slow.
Log4j2 has a plugin model, where all components (loggers, appenders, etc) are
plugins. The log4j2 plugin manager will open a {{JarInputStream}} to the jar
that contains it, and loop over *all* entries in this jar to test if their
package name matches "org.apache.logging.log4j.core" (or optionally any
configured custom plugin packages). If the package name matches, and the entry
(the class) has the right annotations, it is registered as a plugin component.
The standard log4j-core-2.0.jar is less than 700KB with less than 500 entries.
A linear scan over all {{JarEntry}} s in the standard core jar file takes
100-150 milliseconds. How many entries does your {{AppJar.jar}} contain? Can
you try keeping the log4j-core-2.0.jar separate?
> Log4j2 loading time
> -------------------
>
> Key: LOG4J2-565
> URL: https://issues.apache.org/jira/browse/LOG4J2-565
> Project: Log4j 2
> Issue Type: Bug
> Components: API
> Affects Versions: 2.0-rc1
> Environment: Using ejre1.6.0_25 in an ARM926EJ-S rev 5 (v5l)
> Reporter: Tiago Cardoso
>
> Everything runs fine on the Desktop computer, but the embedded system
> struggles to obtain the Logger.
> It takes 17 seconds just to run this line:
> Logger logger = LogManager.getLogger("testLogger");
> The classpath is empty and the whole applications is just:
> public static void main(String[] arg){
> System.out.println("Starting application:" + System.currentTimeMillis());
> Logger logger = LogManager.getLogger("testLogger");
> logger.trace("Going to leave application." + System.currentTimeMillis());
> System.exit(1);
> }
> The same system is able to run a client graphic application without this kind
> of event.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]