Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 833511 - dev-java/log4j-core does not add Log4j2Plugins.dat to installed JAR
Summary: dev-java/log4j-core does not add Log4j2Plugins.dat to installed JAR
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-02-17 04:44 UTC by Yuan Liao (Leo3418)
Modified: 2022-02-17 08:52 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Output of the 'diff' command comparing the JARs' contents (jar-contents.diff,1.48 KB, text/plain)
2022-02-17 04:44 UTC, Yuan Liao (Leo3418)
Details
Output of a Log4j 2 consumer program without Log4j2Plugins.dat (log4j-consumer-log-without-plugins-dat.txt,15.00 KB, text/plain)
2022-02-17 04:46 UTC, Yuan Liao (Leo3418)
Details
Output of a Log4j 2 consumer program when Log4j2Plugins.dat is present (log4j-consumer-log-with-plugins-dat.txt,9.36 KB, text/plain)
2022-02-17 04:52 UTC, Yuan Liao (Leo3418)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuan Liao (Leo3418) 2022-02-17 04:44:53 UTC
Created attachment 765284 [details]
Output of the 'diff' command comparing the JARs' contents

The JAR installed by dev-java/log4j-core does not contain META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat, while the JAR built by the upstream and published to Maven Central for the package does have the file.

This file is a "serialized plugin listing file" that lists the Log4j 2 built-in plugins (https://logging.apache.org/log4j/2.x/manual/plugins.html).  Without this file, none of the Log4j 2 built-in plugins will be loaded during runtime, and consumers of Log4j 2 that need any of those plugins might not have working logging functionality.

To compare the JAR installed by log4j-core-2.17.1.ebuild and the JAR built by the upstream, run these commands:

# emerge -a1 dev-java/log4j-core
$ curl -L https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.17.1/log4j-core-2.17.1.jar > /tmp/log4j-core-2.17.1.jar
$ diff -u <(jar -tf /tmp/log4j-core-2.17.1.jar | sort) <(jar -tf "$(java-config -p log4j-core-2)" | sort)
Comment 1 Yuan Liao (Leo3418) 2022-02-17 04:46:01 UTC
Created attachment 765285 [details]
Output of a Log4j 2 consumer program without Log4j2Plugins.dat
Comment 2 Yuan Liao (Leo3418) 2022-02-17 04:52:28 UTC
Created attachment 765286 [details]
Output of a Log4j 2 consumer program when Log4j2Plugins.dat is present
Comment 3 Yuan Liao (Leo3418) 2022-02-17 08:18:14 UTC
Pasting some of the lines in attachment 765285 [details] to make the error messages more searchable, just in case a similar issue arises on another package:

2022-02-16 20:35:15,514 main ERROR Unable to locate plugin type for Loggers
2022-02-16 20:35:15,515 main ERROR Unable to locate plugin type for Appenders
2022-02-16 20:35:15,517 main ERROR Unable to locate plugin for AppenderRef
2022-02-16 20:35:15,519 main ERROR Unable to locate plugin for Logger
2022-02-16 20:35:15,522 main ERROR Unable to locate plugin for Root
2022-02-16 20:35:15,531 main ERROR Unable to locate plugin for PatternLayout
2022-02-16 20:35:15,531 main ERROR Unable to locate plugin for Console
2022-02-16 20:35:15,531 main ERROR Unable to locate plugin for ThresholdFilter
2022-02-16 20:35:15,531 main ERROR Unable to locate plugin for SizeBasedTriggeringPolicy
2022-02-16 20:35:15,531 main ERROR Unable to locate plugin for Policies
2022-02-16 20:35:15,532 main ERROR Unable to locate plugin for DefaultRolloverStrategy
2022-02-16 20:35:15,532 main ERROR Unable to locate plugin for RollingFile
2022-02-16 20:35:15,537 main WARN No Loggers were configured, using default. Is the Loggers element missing?
2022-02-16 20:35:15,547 main ERROR Unrecognized format specifier [level]
2022-02-16 20:35:15,547 main ERROR Unrecognized conversion specifier [level] starting at position 35 in conversion pattern.
2022-02-16 20:35:15,547 main ERROR Unrecognized format specifier [logger]
2022-02-16 20:35:15,548 main ERROR Unrecognized conversion specifier [logger] starting at position 47 in conversion pattern.
2022-02-16 20:35:15,548 main ERROR Unrecognized format specifier [msg]
2022-02-16 20:35:15,548 main ERROR Unrecognized conversion specifier [msg] starting at position 54 in conversion pattern.
Comment 4 Larry the Git Cow gentoo-dev 2022-02-17 08:52:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9337e7f990a15f7d2860c1dbdf45d60c91894b95

commit 9337e7f990a15f7d2860c1dbdf45d60c91894b95
Author:     Yuan Liao <liaoyuan@gmail.com>
AuthorDate: 2022-02-17 04:12:08 +0000
Commit:     Miroslav Šulc <fordfrog@gentoo.org>
CommitDate: 2022-02-17 08:49:25 +0000

    dev-java/log4j-core: Generate plugin listing file for consumers
    
    The serialized plugin listing file generated by the annotation processor
    invocation allows consumers of Log4j 2 to use the built-in plugins.
    
    Closes: https://bugs.gentoo.org/833511
    Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/24224
    Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>

 dev-java/log4j-core/log4j-core-2.17.1-r1.ebuild | 171 ++++++++++++++++++++++++
 1 file changed, 171 insertions(+)