-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MINOR: log4j2 upgrade follow-up #18290
base: trunk
Are you sure you want to change the base?
Conversation
@frankvicky as @ijuma's comment in https://issues.apache.org/jira/browse/KAFKA-18247, please add the |
a5214a4
to
3b5a4c6
Compare
@@ -227,6 +227,11 @@ <h5><a id="upgrade_400_notable" href="#upgrade_400_notable">Notable changes in 4 | |||
Java 8 support has been removed in Apache Kafka 4.0 | |||
See <a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=181308223">KIP-750</a> for more details | |||
</li> | |||
<li> | |||
Logging framework has been migrated from Log4j to Log4j2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we mention the behavior if you do not convert the configuration files? I believe there is a compatibility mode with some limitations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log4j provides a way to convert Log4j 1.x properties at runtime (Log4j Migration Guide).
To enable this feature, we can set both LOG4J_COMPATIBILITY=true
and specify the configuration file using LOG4J_CONFIGURATION_FILE=file
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to automatically detect if log4j 1.x properties are used and, if so, automatically enable this mode? It seems like a huge problem if customers lose their logging while upgrading to 4.0+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can always enable that compatibility feature as the bridge jar is already included now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better if it can be always enabled with no significant downside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frankvicky thanks for your patch
@@ -1588,7 +1588,6 @@ project(':test-common') { | |||
implementation project(':storage') | |||
implementation project(':server-common') | |||
implementation libs.slf4jApi | |||
implementation libs.jacksonDatabindYaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is required as test-common
needs to parse yaml in production code.
build.gradle
Outdated
@@ -1588,7 +1588,6 @@ project(':test-common') { | |||
implementation project(':storage') | |||
implementation project(':server-common') | |||
implementation libs.slf4jApi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please take a look at @ijuma's comment (#17373 (comment))
maybe we can create a variable to collect them and then add them to implementation for each module:
log4jRuntimeLibs = [
libs.log4j1Bridge2Api
libs.jacksonDatabindYaml
]
log4jLibs = [
libs.slf4jApi
libs.slf4jLog4j2
libs.log4j2Api
libs.log4j2Core
]
...
implementation log4jLibs
runtimeOnly log4jRuntimeLibs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried it on my local machine but it led to tons of failure of tests.
I would keep debugging on my local machine.
@@ -227,6 +227,11 @@ <h5><a id="upgrade_400_notable" href="#upgrade_400_notable">Notable changes in 4 | |||
Java 8 support has been removed in Apache Kafka 4.0 | |||
See <a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=181308223">KIP-750</a> for more details | |||
</li> | |||
<li> | |||
Logging framework has been migrated from Log4j to Log4j2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log4j provides a way to convert Log4j 1.x properties at runtime (Log4j Migration Guide).
To enable this feature, we can set both LOG4J_COMPATIBILITY=true
and specify the configuration file using LOG4J_CONFIGURATION_FILE=file
.
c95cd3c
to
c69d421
Compare
build.gradle
Outdated
implementation libs.opentelemetryProto | ||
implementation libs.protobuf | ||
implementation log4jLibs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, clients and streams should not have any log dependency besides slf4j. The idea is that client modules shouldn't include logging implementations while server modules should. Client modules run alongside user applications and the logging library should be aligned with the application logging library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frankvicky could you please also remove log4j2CoreTest
? it is unused.
config/tools-log4j2.yaml
Outdated
@@ -12,10 +12,20 @@ | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
Configuration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please open a jira for this change? tools-log4j.properties
is still used in code base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1647,6 +1657,9 @@ project(':test-common:test-common-runtime') { | |||
implementation libs.junitPlatformLanucher | |||
implementation libs.junitJupiterApi | |||
implementation libs.junitJupiter | |||
implementation log4jLibs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line#1656 implementation libs.slf4jApi
is unnecessary now.
b4094cd
to
e6000ec
Compare
e6000ec
to
5af4fb4
Compare
Please refer to #17373 (comment) for further details.
This PR does the following things:
kafka-run-class
Committer Checklist (excluded from commit message)