[
https://issues.apache.org/jira/browse/LOG4J2-1659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15630225#comment-15630225
]
Gary Gregory commented on LOG4J2-1659:
--------------------------------------
All Log4j jars use the SAME MANIFEST.MF folder for the DAT file.
Namely
{{META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat}}.
What if each jar used
{{META-INF/GROUP_ID/ARTIFACT_ID/config/plugins/Log4j2Plugins.dat}} instead?
Will the run-time find each one? It must since it seems to find dups of the
same path but in different jars?
Then when an uber jar is created, all DAT files end up in the uber jar. Problem
solved.
Thoughts?
> Facilitate shading Log4j into an application's uber jar
> -------------------------------------------------------
>
> Key: LOG4J2-1659
> URL: https://issues.apache.org/jira/browse/LOG4J2-1659
> Project: Log4j 2
> Issue Type: Improvement
> Reporter: Gary Gregory
>
> Facilitate shading Log4j into an application's uber jar.
> I have a use case where I create an Uber jar for a proprietary JDBC driver
> and all of its dependencies, which includes Log4j (now) 2.7.
> The result is a big fat jar that gets deployed in JBoss Wildfly 9.
> When the server starts up, logging is all messed up:
> {noformat}
> 00:32:06,955 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-api-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,960 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-core-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,961 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-iostreams-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,961 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry icu4j-57.1.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,962 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry icu4j-charset-57.1.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,962 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-jcl-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,963 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry commons-logging-1.2.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,963 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-jmx-gui-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,963 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-nosql-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,964 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-taglib-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,964 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-web-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,964 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry commons-dbcp2-2.1.1.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,965 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry commons-pool2-2.4.2.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,965 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry jansi-1.13.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,965 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry jcommander-1.48.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:06,966 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5)
> WFLYSRV0059: Class Path entry log4j-1.2-api-2.7.jar in
> /content/dv-jdbc-3.1.201610281922-all.jar does not point to a valid jar for
> a Class-Path reference.
> 00:32:07,435 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [d]
> 00:32:07,442 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [d] starting at position 16 in conversion
> pattern.
> 00:32:07,476 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [thread]
> 00:32:07,479 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [thread] starting at position 25 in
> conversion pattern.
> 00:32:07,492 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [level]
> 00:32:07,538 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [level] starting at position 35 in
> conversion pattern.
> 00:32:07,556 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [logger]
> 00:32:07,558 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [logger] starting at position 47 in
> conversion pattern.
> 00:32:07,558 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [msg]
> 00:32:07,559 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [msg] starting at position 54 in conversion
> pattern.
> 00:32:07,560 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [n]
> 00:32:07,561 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [n] starting at position 56 in conversion
> pattern.
> 00:32:07,593 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger No
> log4j2 configuration file found. Using default configuration: logging only
> errors to the console.
> 00:32:07,595 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [d]
> 00:32:07,595 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [d] starting at position 16 in conversion
> pattern.
> 00:32:07,596 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [thread]
> 00:32:07,597 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [thread] starting at position 25 in
> conversion pattern.
> 00:32:07,597 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [level]
> 00:32:07,598 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [level] starting at position 35 in
> conversion pattern.
> 00:32:07,598 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [logger]
> 00:32:07,599 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [logger] starting at position 47 in
> conversion pattern.
> 00:32:07,600 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [msg]
> 00:32:07,600 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [msg] starting at position 54 in conversion
> pattern.
> 00:32:07,601 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized format specifier [n]
> 00:32:07,602 ERROR [stderr] (MSC service thread 1-2) ERROR StatusLogger
> Unrecognized conversion specifier [n] starting at position 56 in conversion
> pattern.
> {noformat}
> What to do? It looks like the uber jar picks up the last plugin DAT file
> (log4j-web).
> Unfortunately, https://github.com/edwgiz/maven-shaded-log4j-transformer does
> not work or I could not get it to work I should say.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]