task #10072
closedUpgrade fully to log4j2
100%
Description
We already upgraded to log4j2 in #9359.
However, the class eu.etaxonomy.cdm.opt.config.LoggingConfigurer is not yet updated as it is not easy to adapt. => removed as not really needed anymore
First, wie need to check if it is still needed.
Also we may want to use xml based configuration instead of properties (but this might be another issue). (an example is FloreDuGabon import).
Also we may want to remove slf4j-reload4j (slf4j-log4j12) as it is not needed anymore (https://www.slf4j.org/manual.html)
Also explicit setLevel() is not recommended according to https://logging.apache.org/log4j/log4j-2.1/manual/migration.html (Converting to the Log4j 2 API - 7) => I tried to remove all setLevel() calls in non-test methods. In tests performance is less critical.
Improve integration into jetty (application server) using logj-appserver (https://logging.apache.org/log4j/2.x/index.html) => #10072
Links:
Related issues
Updated by Andreas Müller over 2 years ago
- Copied from task #9359: Update cdmlib, taxeditor, cdmserver etc. dependencies added
Updated by Andreas Müller over 2 years ago
- Copied to task #10055: Updates, upgrades and cleanup 2023 added
Updated by Andreas Müller about 2 years ago
- Description updated (diff)
- Target version changed from Unassigned CDM tickets to Release 5.32
- % Done changed from 0 to 20
Updated by Andreas Müller about 2 years ago
- Status changed from New to Resolved
- % Done changed from 20 to 60
More or less solved.
Open issues:
handl setLevel() better (see current workaround in cdmlib-commons LogUtils class; better use markers (see log4j docu) or explicit level loggers (e.g eu.etaxonomy.cdm.trace or generally only "trace", "debug" so these are then base loggers for all trace, debug, info, ... logging=> AM: I implemented according methods in LogUtils and adapted existing code (not in tests as they are not time critical); this should be sufficient for now- decide if we should remove more log4j.xml files from cdmlib (e.g. by keeping only 1 file in cdmlib-commons which has some default configurations that can be used everywhere) and others
- logging issue in TaxEditor (see #note-15)
- clean up imports in java files that still have "import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger" in one line (search in eclipse for the st and replace with line break by recompiling class
- clean up explicit class parameter in LogManager.getLogger(xxx) call, better use LogManager.getLogger() without parameter as this is easier to copy and still correct
The both latter tasks can be done in one step by deleting the existing line with "private static final Logger logger = LogManager.getLogger(Class.class);" and replace it with "private static final Logger logger = LogManager.getLogger();". This will rearrange the imports. Remaining LogManager.getLogger(xxx) calls, that are not found by the first search (2 imports in one line) can be found by searching for LogManager.getLogger(A, LogManager.getLogger(B, LogManager.getLogger(C ...
Updated by Andreas Müller about 2 years ago
- Related to task #9205: Remove apache-log4j-extras from TaxEditor dependencies added
Updated by Andreas Müller about 2 years ago
- Assignee changed from Andreas Müller to Katja Luther
Can you please review and maybe work on the clean up open issues a bit so we get clean code soon.
Updated by Andreas Müller about 2 years ago
There is still an issue with log4j-slf4j-impl in TaxEditor. For some reason it is not recognized as existing library when I add it to taxeditor.cdmlib pom, manifest.mf and build.properties as I do with other dependencies.
Therefore data logged via slf4j is still logged as NOP and also stacktraces are thrown during build (see log file in jenkins).
Updated by Andreas Müller about 2 years ago
- Copied to task #10099: Try to use log4j instead of logback in CDM server added
Updated by Andreas Müller about 2 years ago
- Priority changed from New to Priority14
Updated by Andreas Müller about 2 years ago
- Copied to bug #10105: Fix logging in TaxEditor after migration to log4j 2 added
Updated by Andreas Müller about 2 years ago
TaxEditor issue moved to new ticket #10105.
Updated by Andreas Müller about 2 years ago
I also had problems installing the correct logging when running cdmlib test in IDE (here tests in cdmlib-services). This should be further investigated.
Updated by Andreas Müller about 2 years ago
Andreas Müller wrote in #note-15:
There is still an issue with log4j-slf4j-impl in TaxEditor. For some reason it is not recognized as existing library when I add it to taxeditor.cdmlib pom, manifest.mf and build.properties as I do with other dependencies.
Therefore data logged via slf4j is still logged as NOP and also stacktraces are thrown during build (see log file in jenkins).
log4j-slf4j-impl is now recognized, same as jcl-over-slf4j, but the problem still exists
Updated by Andreas Müller about 2 years ago
Updated by Andreas Müller about 2 years ago
Also we may want to handle jboss logging via jsl4j, this is not yet added.
Updated by Andreas Müller about 2 years ago
- Status changed from Resolved to Closed
- Assignee changed from Katja Luther to Andreas Müller
- % Done changed from 70 to 100
This should be fixed. Open issues moved to new tickets.
Updated by Andreas Müller about 2 years ago
- Related to bug #10141: Exception (CCE) caused by logging setLevel in phycobank added