Apache logging log4j over slf4j

Hi :), I am using a lib that uses log4j 2 (apache.logging.log4j.*). My build script (graddle) has easily replaced log4j 1 libs with log4j-over-slf4j, but does not handle log4j 2. Is there a version for log4j 2 ? Or is someone working on it ? Thanks :) Damien

Hi Damien, You can’t use the log4j-over-slf4j adapter (it only works with Log4j 1.2). Log4j2 includes an slf4j adapter: the log4j-slf4j-impl module. See https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html Remko (Shameless plug) Every java main() method deserves http://picocli.info On Wed, Jan 10, 2018 at 10:13 Damien <maitredede@gmail.com> wrote:
Hi :),
I am using a lib that uses log4j 2 (apache.logging.log4j.*).
My build script (graddle) has easily replaced log4j 1 libs with log4j-over-slf4j, but does not handle log4j 2.
Is there a version for log4j 2 ? Or is someone working on it ?
Thanks :)
Damien _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev

Hi, I am using jetty 9 to launch my app, and it do reflection on libs to find extensions, providers, and so on... When I launch my app, I have this error : java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class from jar file:/home/damien/projets/myapp/server/build/serverBaseDir_jetty9/webapps-exploded/localsite-api-server/webapp/WEB-INF/lib/log4j-api-2.9.1.jar at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] ... 6 common frames omitted Caused by: java.lang.IllegalArgumentException: null at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[asm-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[asm-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[asm-5.0.3.jar:5.0.3] at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] ... 6 common frames omitted By replacing log4j 2 with a slf4j bridge, this would fix my problem. Is there any other solution to fix my problem ? Thanks. 2018-01-10 12:21 GMT+11:00 Remko Popma <remko.popma@gmail.com>:
Hi Damien,
You can’t use the log4j-over-slf4j adapter (it only works with Log4j 1.2).
Log4j2 includes an slf4j adapter: the log4j-slf4j-impl module. See https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html
Remko
(Shameless plug) Every java main() method deserves http://picocli.info
On Wed, Jan 10, 2018 at 10:13 Damien <maitredede@gmail.com> wrote:
Hi :),
I am using a lib that uses log4j 2 (apache.logging.log4j.*).
My build script (graddle) has easily replaced log4j 1 libs with log4j-over-slf4j, but does not handle log4j 2.
Is there a version for log4j 2 ? Or is someone working on it ?
Thanks :)
Damien _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev

Looks like jetty uses a version of asm (asm-5.0.3) that cannot handle multi-version jars. This is a bug in asm, not in slf4j or Log4j2. (Shameless plug) Every java main() method deserves http://picocli.info
On Jan 10, 2018, at 10:47, Damien <maitredede@gmail.com> wrote:
Hi,
I am using jetty 9 to launch my app, and it do reflection on libs to find extensions, providers, and so on...
When I launch my app, I have this error : java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class from jar file:/home/damien/projets/myapp/server/build/serverBaseDir_jetty9/webapps-exploded/localsite-api-server/webapp/WEB-INF/lib/log4j-api-2.9.1.jar at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] ... 6 common frames omitted Caused by: java.lang.IllegalArgumentException: null at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[asm-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[asm-5.0.3.jar:5.0.3] at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[asm-5.0.3.jar:5.0.3] at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909) ~[jetty-annotations-9.2.22.v20170606.jar:9.2.22.v20170606] ... 6 common frames omitted
By replacing log4j 2 with a slf4j bridge, this would fix my problem. Is there any other solution to fix my problem ?
Thanks.
2018-01-10 12:21 GMT+11:00 Remko Popma <remko.popma@gmail.com>:
Hi Damien,
You can’t use the log4j-over-slf4j adapter (it only works with Log4j 1.2).
Log4j2 includes an slf4j adapter: the log4j-slf4j-impl module. See https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html
Remko
(Shameless plug) Every java main() method deserves http://picocli.info
On Wed, Jan 10, 2018 at 10:13 Damien <maitredede@gmail.com> wrote: Hi :),
I am using a lib that uses log4j 2 (apache.logging.log4j.*).
My build script (graddle) has easily replaced log4j 1 libs with log4j-over-slf4j, but does not handle log4j 2.
Is there a version for log4j 2 ? Or is someone working on it ?
Thanks :)
Damien _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev

Hi, Also, correct me if I am wrong, but the log4j-slf4j-impl module is to allow slf4j app to log to log4j, but I want a log4j2 app to log to slf4j... Damien 2018-01-10 12:21 GMT+11:00 Remko Popma <remko.popma@gmail.com>:
Hi Damien,
You can’t use the log4j-over-slf4j adapter (it only works with Log4j 1.2).
Log4j2 includes an slf4j adapter: the log4j-slf4j-impl module. See https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html
Remko
(Shameless plug) Every java main() method deserves http://picocli.info
On Wed, Jan 10, 2018 at 10:13 Damien <maitredede@gmail.com> wrote:
Hi :),
I am using a lib that uses log4j 2 (apache.logging.log4j.*).
My build script (graddle) has easily replaced log4j 1 libs with log4j-over-slf4j, but does not handle log4j 2.
Is there a version for log4j 2 ? Or is someone working on it ?
Thanks :)
Damien _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev

On Jan 10, 2018, at 11:04, Damien <maitredede@gmail.com> wrote:
Hi,
Also, correct me if I am wrong, but the log4j-slf4j-impl module is to allow slf4j app to log to log4j, but I want a log4j2 app to log to slf4j...
If you want to go the opposite way you should exclude log4j-core and use the log4j-to-slf4j module. See: https://logging.apache.org/log4j/2.x/faq.html#which_jars
Damien
2018-01-10 12:21 GMT+11:00 Remko Popma <remko.popma@gmail.com>:
Hi Damien,
You can’t use the log4j-over-slf4j adapter (it only works with Log4j 1.2).
Log4j2 includes an slf4j adapter: the log4j-slf4j-impl module. See https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html
Remko
(Shameless plug) Every java main() method deserves http://picocli.info
On Wed, Jan 10, 2018 at 10:13 Damien <maitredede@gmail.com> wrote: Hi :),
I am using a lib that uses log4j 2 (apache.logging.log4j.*).
My build script (graddle) has easily replaced log4j 1 libs with log4j-over-slf4j, but does not handle log4j 2.
Is there a version for log4j 2 ? Or is someone working on it ?
Thanks :)
Damien _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev

Thanks for the tip about `wich_jars`. For the "asm" version, I have downgraded to jetty 8. Thanks for your help :) Damien 2018-01-10 13:42 GMT+11:00 Remko Popma <remko.popma@gmail.com>:
On Jan 10, 2018, at 11:04, Damien <maitredede@gmail.com> wrote:
Hi,
Also, correct me if I am wrong, but the log4j-slf4j-impl module is to allow slf4j app to log to log4j, but I want a log4j2 app to log to slf4j...
If you want to go the opposite way you should exclude log4j-core and use the log4j-to-slf4j module. See: https://logging.apache.org/log4j/2.x/faq.html#which_jars
Damien
2018-01-10 12:21 GMT+11:00 Remko Popma <remko.popma@gmail.com>:
Hi Damien,
You can’t use the log4j-over-slf4j adapter (it only works with Log4j 1.2).
Log4j2 includes an slf4j adapter: the log4j-slf4j-impl module. See https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html
Remko
(Shameless plug) Every java main() method deserves http://picocli.info
On Wed, Jan 10, 2018 at 10:13 Damien <maitredede@gmail.com> wrote:
Hi :),
I am using a lib that uses log4j 2 (apache.logging.log4j.*).
My build script (graddle) has easily replaced log4j 1 libs with log4j-over-slf4j, but does not handle log4j 2.
Is there a version for log4j 2 ? Or is someone working on it ?
Thanks :)
Damien _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
_______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev
participants (2)
-
Damien
-
Remko Popma