Script for upgrading log4j jar files.
sh log4j-upgrade.sh <dir to search for log4j>
sh log4j-upgrade.sh /
-
It identifies the latest log4j version, where to download from, where to search for log4j and a temporary working directory.
-
Checks whether wget is installed and a working directory (
/tmp/log4j/
) exists. -
Downloads the latest
log4j
binaries. -
Extracts the downloaded binaries.
-
Searches to find
log4j
files matching the pattern*log4j*.jar
within the given search directory. -
Backups the current version of the log4j library (e.g.
log4j-core
,log4j-web
, etc.). -
Copies the new libary (
.jar
) file to the found directory containing the old version.
The script does not consider the following:
-
File rights and permissions (
chmod
,chown
), -
Detecting permission errors (though, you would receive a error message),
-
Eventual needed configuration implementations (e.g. where a configuration file for an application points to a specific
.jar
file containing the version number) -
The script is not written to be used as a interactive script (though, an implementation of this would be an easy fix)