[slf4j-dev] Apache logging log4j over slf4j

Remko Popma remko.popma at gmail.com
Wed Jan 10 04:03:04 CET 2018


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 at 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 at 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 at 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 at qos.ch
>>> http://mailman.qos.ch/mailman/listinfo/slf4j-dev
>> 
>> _______________________________________________
>> slf4j-dev mailing list
>> slf4j-dev at qos.ch
>> http://mailman.qos.ch/mailman/listinfo/slf4j-dev
> 
> _______________________________________________
> slf4j-dev mailing list
> slf4j-dev at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-dev/attachments/20180110/3784ff6f/attachment.html>


More information about the slf4j-dev mailing list