Spring Security
  1. Spring Security
  2. SEC-1458

HttpSessionEventPublisher has static Log. it causes the log4j configuration to happen before Log4jConfigListener

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 3.0.3, 3.1.0.M1
    • Component/s: Core
    • Labels:
      None
    • Environment:
      tomcat 6

      Description

      Although the first listener in my web.xml is the Log4jConfigListener. the log4j configuration happens before getting there.
      It happens because I also have HttpSessionEventPublisher listener that has a static Log, when the static Log is initialized it causes the log4j default configuration.
      The problem is that some loggers from the default configuration are still alive even after the Log4jConfigListener is called.
      Changing the Log to not being static should solve the issue.

        Activity

        Hide
        Ido Tzang added a comment -

        Actually, after testing further, making the field an instance field rather than static does not solve the problem - it appears as if Tomcat instantiates all listener objects before calling them.

        we ended up changing Log4jConfigListener to call shutdownLogging before initLogging, to clear the Log4j configuration.

        Not sure if this is a Spring Security issue...

        Show
        Ido Tzang added a comment - Actually, after testing further, making the field an instance field rather than static does not solve the problem - it appears as if Tomcat instantiates all listener objects before calling them. we ended up changing Log4jConfigListener to call shutdownLogging before initLogging, to clear the Log4j configuration. Not sure if this is a Spring Security issue...
        Hide
        Luke Taylor added a comment -

        I think this is essentially the same problem as reported in SPR-5977. I've removed the logger field from HttpSessionEventPublisher. The logger reference is now obtained in each method before using it.

        Show
        Luke Taylor added a comment - I think this is essentially the same problem as reported in SPR-5977 . I've removed the logger field from HttpSessionEventPublisher. The logger reference is now obtained in each method before using it.

          People

          • Assignee:
            Luke Taylor
            Reporter:
            Ido Tzang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: