[
https://issues.apache.org/jira/browse/LOG4J2-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14105831#comment-14105831
]
Romain Manni-Bucau commented on LOG4J2-658:
-------------------------------------------
Working on JCache implementation in JCS project I popped up the issue that it
would be nice to drop commons-logging for a little facade to be able to switch
it. I had in mind TomEE integration which mandates JUL by default but should
support slf4j, log4j etc...(yes at this point I fogot about log4j2). Then
somebody on commons list (because commons-jcs project) said "and log4j2". He
was right. A bit later I checked tomee log4j support with log4j2 implementation
and got two main glitches after the one I was able to fix in TomEE projects:
1) I lost all my shutdown messages (which can be quite important since it
ensure everything is cleanup including resources)
2) PropertyConfigurator is now a no-op impl so tomee default config
(conf/logging.properties) is ignored - this one is less important since there
are ways to workaround it more or less
Regarding TomEE: it is actually a tomcat behavior. Tomcat adds a shutdown hook
to kill the server when ctrl+c is hitten. Since depending the JVMs hooks can be
executed concurrently then you have no guarantee log4j didn't shutdown before
tomcat (and actually since it is faster it is pretty sure).
Side note: I have the same situtation at work with several tooling using
shutdown hooks, that's why I said it is a general java issue and integrating
with each framework/container is too hard IMHO.
> shutdown hook called too early
> ------------------------------
>
> Key: LOG4J2-658
> URL: https://issues.apache.org/jira/browse/LOG4J2-658
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0-rc1, 2.0-rc2, 2.0.2
> Reporter: Romain Manni-Bucau
> Assignee: Matt Sicker
>
> Hi
> this issue follow few mail exchanges from the commons list. Here the
> interesting part for log4j2:
> {quote}
> Here what I do (we can move it to another thread since that's 100% log4j2
> related):
> unzip apache-tomee-1.7.0-SNAPSHOT-webprofile.zip &&
> cd apache-tomee-webprofile-1.7.0-SNAPSHOT/ &&
> rm conf/logging.properties &&
> echo 'openejb.log.factory=log4j'>conf/system.properties &&
> cp ~/log4j2.xml conf/log4j2.xml &&
> cp
> ~/.m2/repository/org/apache/logging/log4j/log4j-api/2.0-rc2-SNAPSHOT/log4j-api-2.0-rc2-SNAPSHOT.jar
> lib/ &&
> cp
> ~/.m2/repository/org/apache/logging/log4j/log4j-core/2.0-rc2-SNAPSHOT/log4j-core-2.0-rc2-SNAPSHOT.jar
> lib/ &&
> cp
> ~/.m2/repository/org/apache/logging/log4j/log4j-1.2-api/2.0-rc2-SNAPSHOT/log4j-1.2-api-2.0-rc2-SNAPSHOT.jar
> lib/ &&
> ./bin/catalina.sh
> it makes server starting with log4j2 logs, if you ctrl+c logs are not
> printed. Sure it is cause context is closed too early and then loggers have
> NullConfiguration. (If I debug in java.lang.ApplicationShutdownHooks#runHooks
> to wait all hooks exec it works)
> {quote}
> Basically the issue is that when shutting down with ctrl+C some logs are
> swallowed.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]