Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7050

Log4jAgent should avoid casting non-log4j loggers

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.0, 1.10.0
    • Fix Version/s: 1.9.1, 1.10.0
    • Component/s: logging
    • Labels:
      None

      Description

      Users should be able to use SLF4J API with Geode even when log4j-core is in the class path and the Geode log4j appenders are being used.

      Log4jAgent assumes that all Loggers are Log4J loggers. This can result in a ClassCastException when encountering an instance of SLF4JLogger.

      Caused by: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLogger cannot be cast to org.apache.logging.log4j.core.Logger
      	at org.apache.geode.internal.logging.log4j.Log4jAgent.getRootLoggerContext(Log4jAgent.java:91)
      	at org.apache.geode.internal.logging.log4j.Log4jAgent.getConfiguration(Log4jAgent.java:95)
      	at org.apache.geode.internal.logging.log4j.Log4jAgent.isUsingGemFireDefaultConfig(Log4jAgent.java:80)
      	at org.apache.geode.internal.logging.log4j.Log4jAgent.shouldUpdateLogLevels(Log4jAgent.java:129)
      	at org.apache.geode.internal.logging.log4j.Log4jAgent.configure(Log4jAgent.java:107)
      	at org.apache.geode.internal.logging.Configuration.configChanged(Configuration.java:152)
      	at org.apache.geode.internal.logging.Configuration.initialize(Configuration.java:141)
      	at org.apache.geode.internal.logging.LoggingSession.createSession(LoggingSession.java:65)
      	at org.apache.geode.distributed.internal.InternalDistributedSystem.initialize(InternalDistributedSystem.java:762)
      	at org.apache.geode.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.java:446)
      	at org.apache.geode.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.java:432)
      	at org.apache.geode.distributed.internal.InternalDistributedSystem.connectInternal(InternalDistributedSystem.java:257)
      	at org.apache.geode.distributed.DistributedSystem.connect(DistributedSystem.java:164)
      	at org.apache.geode.cache.client.ClientCacheFactory.basicCreate(ClientCacheFactory.java:243)
      	at org.apache.geode.cache.client.ClientCacheFactory.create(ClientCacheFactory.java:214)
      	at org.springframework.data.gemfire.client.ClientCacheFactoryBean.createCache(ClientCacheFactoryBean.java:391)
      	at org.springframework.data.gemfire.CacheFactoryBean.resolveCache(CacheFactoryBean.java:325)
      	at org.springframework.data.gemfire.CacheFactoryBean.init(CacheFactoryBean.java:269)
      	... 107 more
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                klund Kirk Lund
                Reporter:
                klund Kirk Lund
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m