Skip to content

Move bookkeeper-server log4j2.xml out of the published jar - #4919

Open
henriquejsza wants to merge 1 commit into
apache:masterfrom
henriquejsza:bk-4603-remove-log4j2-from-server-jar
Open

henriquejsza wants to merge 1 commit into
apache:masterfrom
henriquejsza:bk-4603-remove-log4j2-from-server-jar

Conversation

@henriquejsza

Copy link
Copy Markdown

Fix #4603

Motivation

Log4j advises that libraries only add configuration files to their test
classpath, so they do not override a downstream application's configuration via
Log4j2 automatic configuration
(https://logging.apache.org/log4j/2.x/manual/configuration.html#automatic-configuration).

The bookkeeper-server jar bundles log4j2.xml at its root
(bookkeeper-server/src/main/resources/log4j2.xml). As reported, this file can
be picked up by consumers such as Pulsar when their own module does not provide
a configuration file.

Changes

  • Move log4j2.xml from bookkeeper-server/src/main/resources to
    bookkeeper-server/src/test/resources. The console configuration is still
    used when running the module's tests, but the file is no longer packaged into
    the published artifact.

The server distribution is unaffected: it loads conf/log4j2.xml (assembled
from the top-level conf directory in bookkeeper-dist and referenced by
bin/common.sh), not the jar-bundled file.

Log4j advises libraries to keep configuration files on the test classpath
only, so they do not override a downstream application's configuration via
Log4j2 automatic configuration. The bookkeeper-server jar bundled
log4j2.xml at its root, which could be picked up by consumers such as
Pulsar when their own module lacked a configuration file.

Move log4j2.xml from src/main/resources to src/test/resources so the
console configuration is still used when running the module's tests but is
no longer packaged into the published artifact. The server distribution is
unaffected: it loads conf/log4j2.xml (assembled from the top-level conf
directory and referenced by bin/common.sh), not the jar-bundled file.

Signed-off-by: henriquejsza <henriquejsza@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] BookKeeper jar files contain log4j2 configuration files which is against Log4J recommendation

1 participant