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

Update or remove log4j from client #108

Open
cseppan opened this issue Jul 20, 2022 · 2 comments
Open

Update or remove log4j from client #108

cseppan opened this issue Jul 20, 2022 · 2 comments

Comments

@cseppan
Copy link
Collaborator

cseppan commented Jul 20, 2022

Message seen when running the EMF Client

Upgrade to Apache Log4j version 2.16.0 or later since 1.x is end of life.

Check if log4j library is needed for client and remove if not needed. If library is removed, check if EMF Client Installer removes the jar file when run (installer probably doesn't have this feature so will need a new issue to add it).

@cseppan
Copy link
Collaborator Author

cseppan commented Jul 28, 2022

More info about how Log4j is used in the EMF:

The EMF uses Apache Commons Logging which works with different logging implementations. The EMF server component uses Log4j as the logging implementation by including the log4j jar and a log4j.properties file in the WAR archive. A typical usage is:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class DataServiceImpl implements DataService {
    private static Log LOG = LogFactory.getLog(DataServiceImpl.class);

    public void archiveDataset() {
        try {
            ....
        } catch (Exception e) {
            LOG.error("Error archiving dataset", e);
            throw new EmfException(e.getMessage());
        }

On the server, the log4j.properties file adds formatting to the log messages that are written to Tomcat's catalina.out log file and also creates rolling logs in the user's home directory (emf.log, emf-rolling.log).

While the EMF Client has a very few direct uses of LogFactory and includes the log4j jar file, there's no log4j.properties file so Log4j isn't actually used. On startup, warnings are printed to stderr:

Starting EMF Client
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Removing the log4j jar from the lib/ directory doesn't cause any problems for running the EMF Client.

@cseppan
Copy link
Collaborator Author

cseppan commented Jul 28, 2022

The EMF Client Installer program will delete outdated files. The installer keeps track of the existing list of files in the update.dat archive and compares it to the freshly downloaded list in files.txt. Any out-of-date files are deleted. The installer also rewrites the EMFClient.bat file and updates the classpath each time the installer is run.

@cseppan cseppan added this to the v4.2 release (Feb. 2023) milestone Dec 22, 2022
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

No branches or pull requests

1 participant