Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6881

Switch to log4j2

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Neutral Neutral
    • None
    • None
    • None
    • None

      Magnolia still uses log4j although it has a severe performance bug in org.apache.log4j.Category:204 (method callAppenders()), namely the synchronized block there.
      This bug effectively causes all log messages to be synchronized per category/logger, which means that ultimately all logging is synchronized in all reasonable scenarios somebody might run Magnolia in (including the Magnolia default configuration). This is because normally all log messages ultimately fall through to the root category, where they will be synchronized with each other.
      Having synchronization at this stage not only defeats a lot of the advantages that asynchronous loggers (which you employ) could bring, it also means that multithreaded logging in advanced Magnolia apps substantially slows down everything, particularly since the synchronized block I'm talking about contains quite some code and spends some time per log message.

      A natural improvement would be the switch to log4j2, which is already available in version 2.7. There is also a bridge available which allows you to use the conventional log4j code to create loggers (so you don't need to adapt each of cour classes before you can switch to log4j2).
      I excluded log4j from your artifacts (in my pom.xml) and installed log4j2 including that bridge. The good news: Magnolia starts up. However two things obviously remain to be done:
      1) rewrite log4j.xml (or write log4j2.xml for that matter) to reflect good defaults.
      2) fix the Log Tools app in Magnolia (which currently throws exceptions when trying to run on log4j2, even with the bridge in place).

        Acceptance criteria

              Unassigned Unassigned
              tlandmann Torsten Landmann
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD