Skip to content
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

[AMQ-7426] Upgrade to log4j2 #662

Merged
merged 1 commit into from
Feb 27, 2022
Merged

[AMQ-7426] Upgrade to log4j2 #662

merged 1 commit into from
Feb 27, 2022

Conversation

jbonofre
Copy link
Member

No description provided.

@jbertram
Copy link
Contributor

You'll definitely want to use something newer than 2.14.1 given the recently discovered severe vulnerability.

pom.xml Outdated Show resolved Hide resolved
@jbonofre jbonofre force-pushed the AMQ-7426 branch 2 times, most recently from c5dc061 to f76c09f Compare January 17, 2022 16:03
@jbonofre
Copy link
Member Author

Runtime/assembly works fine. Now I have to fix some tests which are using log4j (logger/appender).

@jbonofre jbonofre force-pushed the AMQ-7426 branch 2 times, most recently from d7b6621 to cf571ce Compare February 21, 2022 05:08
@gemmellr
Copy link
Member

Test configs can/should use 'log4j2-test.properties' rather than 'log4j2.properties', it has a higher priority than regular files and makes it easier/quicker to distinguish the non-test config amongst the sea of files.

@gemmellr
Copy link
Member

There remain a lot of dependencies on log4j 1.x even after these changes. I'd suggest you should take a look at some of the AMQ 8472 related reload4j changes again and incorporating related aspects to address them (e.g perhaps also using the log4j2 api bridge for them if needed).

$ mvn dependency:tree | grep " log4j:log4j"
[INFO] | +- log4j:log4j:jar:1.2.17:test
[INFO] | +- log4j:log4j:jar:1.2.12:compile (optional)
[INFO] | +- log4j:log4j:jar:1.2.12:compile (optional)
[INFO] | +- log4j:log4j:jar:1.2.12:compile (optional)
[INFO] | +- log4j:log4j:jar:1.2.17:provided
[INFO] | +- log4j:log4j:jar:1.2.12:compile
[INFO] | | +- log4j:log4j:jar:1.2.12:compile
[INFO] | - log4j:log4j:jar:1.2.17:compile
[INFO] | +- log4j:log4j:jar:1.2.12:compile
[INFO] | +- log4j:log4j:jar:1.2.12:compile
[INFO] | +- log4j:log4j:jar:1.2.12:compile
[INFO] | +- log4j:log4j:jar:1.2.12:compile
[INFO] | +- log4j:log4j:jar:1.2.17:compile
[INFO] | | +- log4j:log4j:jar:1.2.17:compile
[INFO] | +- log4j:log4j:jar:1.2.12:compile
[INFO] | +- log4j:log4j:jar:1.2.17:compile

$ mvn dependency:tree | grep "slf4j-log4j12"
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:provided
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] | | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile

@jbonofre
Copy link
Member Author

I will review the dependencies. Regarding log4j properties, it uses the same as before. So I guess the comment is not related to log4j2 update but more general comment.

@gemmellr
Copy link
Member

I'd say its a comment about the update since you are creating all the new files now, and I dont think log4j 1 had that functionality.

@jbonofre
Copy link
Member Author

Catcha. Thanks. I'm updating the PR.

@gemmellr
Copy link
Member

Still seeing a bunch of log4j 1.x deps, less than before but still several. Same number of slf4j-log4j12 deps.

@jbonofre
Copy link
Member Author

@gemmellr most of them are coming from commons-logging dependency in activeio. Should I exclude it ?

@gemmellr
Copy link
Member

I would say so, if the idea is to not use Log4J 1.x, then there should be no trace of it. Those bits should be using Log4J 2 (via the 1.2 bridge), or a less apealling alternative would be subbing in reload4j, but that doesnt really make sense given the context.

@jbonofre
Copy link
Member Author

Alright, I add the exclude.

pom.xml Show resolved Hide resolved
activemq-shiro/pom.xml Outdated Show resolved Hide resolved
@jbonofre
Copy link
Member Author

@gemmellr PR updated

Copy link
Member

@gemmellr gemmellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some remaining log4j 1 instances (from zookeeper and pax stuff, as on the reload4j PR):

$ mvn dependency:tree|grep " log4j:log4j"
[INFO] | +- log4j:log4j:jar:1.2.17:provided
[INFO] | - log4j:log4j:jar:1.2.17:compile
[INFO] | +- log4j:log4j:jar:1.2.17:compile
[INFO] | | +- log4j:log4j:jar:1.2.17:compile
[INFO] | +- log4j:log4j:jar:1.2.17:compile

$ mvn dependency:tree|grep "slf4j-log4j12"
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:provided
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] | | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile

assembly/pom.xml Outdated
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j-version}</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant version declaration, it is (once again) managed.

@gemmellr
Copy link
Member

gemmellr commented Feb 23, 2022

Still some remaining log4j 1 instances (from zookeeper and pax stuff, as on the reload4j PR):

This much should be expected given it was one of the main things in the reload4j PR, e.g 1f01a61#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R623-R656 and 1f01a61#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R491-R512

A likely difference in this case might be the addition of the log4j2 bridge for the 1.2 api.

@jbonofre
Copy link
Member Author

@gemmellr let me double check, I thought I did it already.

@gemmellr
Copy link
Member

Easy to check with a little grep :)

pom.xml Outdated Show resolved Hide resolved
@jbonofre
Copy link
Member Author

No log4j1 dep anymore

@cshannon
Copy link
Contributor

I don't see log4j1 anymore so that part looks good

@gemmellr
Copy link
Member

Yep, no log4j 1 and no slf4j-log4j12 mentions now. The mentions of log4j look to all be 2.17.1 now.

@cshannon
Copy link
Contributor

I think this is ready to merge at this point if the tests pass (i don't think i see any other changes)

@gemmellr
Copy link
Member

Think it needs a rebase after the recent force push on main. The Jenkins build fell over, and prodding a restart it doesnt like trying to merge it.

@jbonofre
Copy link
Member Author

Rebased

@jbonofre
Copy link
Member Author

Last change breaks some tests, I'm fixing (probably due to dependency updates). I'm on it.

@jbonofre
Copy link
Member Author

All should be good now. I'm just waiting for Jenkins green light before merging.

@cshannon
Copy link
Contributor

@jbonofre - We all good to merge?Looks like the checks passed

@jbonofre jbonofre merged commit e597017 into apache:main Feb 27, 2022
@jbonofre jbonofre deleted the AMQ-7426 branch February 27, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet