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

[WIP] Replace log4j with slf4j #977

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Commits on Mar 2, 2022

  1. Replace log4j import lines and logger declarations with slf4j

    Perform elementary conversion of log4j constructs with slf4j. It also replaces the usage of `fatal` with `error` methods and calls `toString` on objects passed by parameter to logger methods.
    
    This commit doesn't touch classes into:
    
    - Applications
    - Archives
    - Tests
    
    It also leaves frameworks not built by Maven intact.
    hprange committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    40bcab4 View commit details
    Browse the repository at this point in the history
  2. Replace log4j with slf4j on AjaxRemoteLogging

    AjaxRemoteLogging component doesn't support the log level `fatal` anymore. In contrast, `trace` was added as a log level option.
    hprange committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    f1e9328 View commit details
    Browse the repository at this point in the history
  3. Remove toggle rule tracing while debugging D2W apps in development mode

    I'm not happy with this change. Anyway, I removed this option because it's impossible to change the log level using slf4j in runtime without knowing the underlying log library being used.
    hprange committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    230ef5b View commit details
    Browse the repository at this point in the history
  4. Remove log level WARN from WOOgnl classes.

    The log level was set as `Level.WARN` in the `WOHelperFunctionDeclarationParser`, `WOHelperFunctionHTMLParser` and `WOHelperFunctionTagRegistry` classes. This configuration was removed because it's impossible to set the log level in runtime using slf4j.
    hprange committed Mar 2, 2022
    Configuration menu
    Copy the full SHA
    84cc50d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b09dc72 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2022

  1. Migrate log4j NDC to slf4j MDC statements

    The `ERD2WPage` component uses `log4j` Nested Diagnostic Context (NDC) statements, which `slf4j` doesn't support. For this reason, we're migrating to Mapped Diagnostic Context (MDC) statements.
    hprange committed Mar 3, 2022
    Configuration menu
    Copy the full SHA
    ceeda9a View commit details
    Browse the repository at this point in the history
  2. Replace reference to org.apache.log4j.Logger on WOCGIFormValues

    The `com.webobjects.appserver._private.WOCGIFormValues.Encoder` class of the `JavaWebObjects` framework creates a `org.apache.log4j.Logger`. Since we can't modify this class, I had to copy it into the `ERExtensions` framework—to supersede the original class—and reference the `org.slf4j.Logger` interface.
    hprange committed Mar 3, 2022
    Configuration menu
    Copy the full SHA
    3e0d91a View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2022

  1. Change the ERXLogger class to implement the SLF4J interface and suppo…

    …rt multiple logging libraries
    
    The `ERXLogger` class now implements the `org.slf4j.Logger` interface instead of extending the `org.apache.log4j.Logger` class. It's not connected to `log4j` in any sense anymore.
    
    Add a new `ERXNSLogSlf4jBridge` class to make the bridge between `NSLog` and `slf4j`.
    
    Move the re-initialization of `log4j` console appenders to the new class `ERXLoggingUtilities` and execute this code only if `log4j` is the chosen `sfl4j` binding.
    
    Support setting the log level using distinct log libraries via the `ERXLoggingUtilities` class.
    
    Side-effects:
    
    - Remove the ability to configure a custom subclass of `ERXLogger` using the `er.extensions.erxloggerclass` property.
    - Remove the `er.extensions.logging.ERXLogger.Factory` class since it implements `org.apache.log4j.spi.LoggerFactory`. Thus, it's not possible to define a custom `ERXLogger` factory anymore.
    hprange committed Mar 4, 2022
    Configuration menu
    Copy the full SHA
    6d628e8 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2022

  1. Replace log4j utils reference with commons-io

    Replace `org.apache.log4j.lf5.util.StreamUtils` with `org.apache.commons.io.IOUtils.copy` on `ImageMagickCommandlineMetadataParser`.
    hprange committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    0cc1be6 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2022

  1. Add toggle rule tracing back while debugging D2W apps in development …

    …mode
    
    Now, Wonder can change the log level of a few logging libraries: log4j 1, reload4j, log4j 2, and logback.
    hprange committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    53473f3 View commit details
    Browse the repository at this point in the history
  2. Fix typo

    hprange committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    62b88b8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f7d2dc1 View commit details
    Browse the repository at this point in the history
  4. Add wonder-bom module and remove JavaXML as a dependency

    The wonder-bom groups all WebObjects and Wonder dependencies into one pom. It also excludes `JavaXML` as a transitive dependency of the `JavaWebObjects` dependency. `JavaXML` has also been removed as a direct dependency of all frameworks.
    hprange committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    2530100 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2022

  1. Configuration menu
    Copy the full SHA
    fae5dc8 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2022

  1. Add required dependency to Apache Xerces on JavaMonitor and wotaskd

    The removal of the JavaXML transitive dependency from both applications caused NoClassDefError exceptions. This commit adds the Apache Xerces as an explicit dependency to both projects.
    hprange committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    3d55103 View commit details
    Browse the repository at this point in the history