Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check the version number of Log4j in a .jar file?

I have a .jar project which may be using Log4j. How can I check the version number of that Log4j?

It's an executable JAR file. I don't have the source code and can't decompile it.

like image 988
Sourav Avatar asked Sep 19 '25 23:09

Sourav


2 Answers

Decompress the JAR file and look for the manifest file (META-INF\MANIFEST.MF)

unzip -p file.jar META-INF/MANIFEST.MF
like image 70
Danil Perestoronin Avatar answered Sep 22 '25 13:09

Danil Perestoronin


There are two ways to do this

Way 1:

jar -tfv my.jar | grep -i log4

  23590 Tue Aug 10 10:51:24 IST 2021 log4j-slf4j-impl-2.13.3.jar
  32722 Tue Aug 10 10:51:24 IST 2021 log4j-web-2.13.3.jar
1714164 Tue Aug 10 10:51:24 IST 2021 log4j-core-2.13.3.jar
  23702 Tue Aug 10 10:51:24 IST 2021 log4j-over-slf4j-1.7.30.jar
 292301 Tue Aug 10 10:51:24 IST 2021 log4j-api-2.13.3.jar
  11259 Tue Aug 10 10:50:10 IST 2021 log4j2.xml

Way 2:

unzip -l my.jar | grep -i log4

    23590  08-10-2021 10:51   log4j-slf4j-impl-2.13.3.jar
    32722  08-10-2021 10:51   log4j-web-2.13.3.jar
  1714164  08-10-2021 10:51   log4j-core-2.13.3.jar
    23702  08-10-2021 10:51   log4j-over-slf4j-1.7.30.jar
   292301  08-10-2021 10:51   log4j-api-2.13.3.jar
    11259  08-10-2021 10:50   log4j2.xml
like image 32
Manoj Avatar answered Sep 22 '25 11:09

Manoj