title: Upgrade log4j1.2.x to log4j2.17 in Grails 2.5.4
body: <p>I'm upgrading log4j dependency in my <em>grails 2.5.4</em> application from <em>1.2.17</em> to the latest version <em>2.17</em></p>
  <p>I've excluded log4j from the <em>BuildConfig.groovy</em> and added the following dependencies pertaining to <em>v2.17</em>:</p>
  <ul>
  <li>log4j-api</li>
  <li>log4j-core</li>
  <li>log4j-1.2-api</li>
  <li>log4j-slf4j-impl</li>
  </ul>
  <p>I'm using the log4-1.x bridge to reduce overall codebase change. When the application boots up, I get the following exception, even though the application boots up completely.</p>
  <pre><code>Error |
  java.lang.RuntimeException: Reloading agent exited via exception, please raise a jira
  Error |
      at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:110)
  Error |
      at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
  Error |
      at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
  Error |
      at sun.misc.Unsafe.defineAnonymousClass(Native Method)
  Error |
      at java.lang.invoke.InnerClassLambdaMetafactory.spinInnerClass(InnerClassLambdaMetafactory.java:326)
  Error |
      at java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:194)
  Error |
      at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:304)
  Error |
      at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
  Error |
      at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
  Error |
      at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
  Error |
      at org.apache.logging.log4j.util.PropertiesUtil$Environment.&lt;init&gt;(PropertiesUtil.java:430)
  Error |
      at org.apache.logging.log4j.util.PropertiesUtil$Environment.&lt;init&gt;(PropertiesUtil.java:420)
  Error |
      at org.apache.logging.log4j.util.PropertiesUtil.&lt;init&gt;(PropertiesUtil.java:74)
  Error |
      at org.apache.logging.log4j.util.PropertiesUtil.&lt;clinit&gt;(PropertiesUtil.java:54)
  Error |
      at org.apache.logging.log4j.util.Constants.&lt;clinit&gt;(Constants.java:30)
  Error |
      at org.apache.logging.log4j.spi.AbstractLogger.createClassForProperty(AbstractLogger.java:207)
  Error |
      at org.apache.logging.log4j.spi.AbstractLogger.&lt;clinit&gt;(AbstractLogger.java:95)
  Error |
      at org.apache.logging.slf4j.Log4jLoggerFactory.&lt;clinit&gt;(Log4jLoggerFactory.java:35)
  Error |
      at org.slf4j.impl.StaticLoggerBinder.&lt;init&gt;(StaticLoggerBinder.java:53)
  Error |
      at org.slf4j.impl.StaticLoggerBinder.&lt;clinit&gt;(StaticLoggerBinder.java:41)
  Error |
      at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
  Error |
      at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
  Error |
      at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
  Error |
      at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
  Error |
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
  Error |
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
  Error |
      at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:274)
  Error |
      at org.codehaus.groovy.grails.io.support.PathMatchingResourcePatternResolver.&lt;clinit&gt;(PathMatchingResourcePatternResolver.java:151)
  Error |
      at org.codehaus.groovy.grails.cli.GrailsScriptRunner.getAvailableScripts(GrailsScriptRunner.java:824)
  Error |
      at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:427)
  Error |
      at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:414)
  Error |
      at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:378)
  Error |
      at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:226)
  Error |
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  Error |
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  Error |
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  Error |
      at java.lang.reflect.Method.invoke(Method.java:498)
  Error |
      at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
  Error |
      at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:236)
  Error |
      at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
  Error |
  Caused by: java.lang.NullPointerException
  Error |
      at org.springsource.loaded.SystemPropertyConfiguredIsReloadableTypePlugin.shouldBeMadeReloadable(SystemPropertyConfiguredIsReloadableTypePlugin.java:121)
  Error |
      at org.springsource.loaded.TypeRegistry.isReloadableTypeName(TypeRegistry.java:858)
  Error |
      at org.springsource.loaded.agent.SpringLoadedPreProcessor.preProcess(SpringLoadedPreProcessor.java:192)
  Error |
      at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:107)
  Error |
      ... 39 more
  </code></pre>
  <p>I further observed that the application is using the default logging configuration which includes:</p>
  <pre><code>org.hibernate.engine.internal.StatisticalLoggingSessionEventListener end
  INFO: Session Metrics
  </code></pre>
  <p>I've configured both <em>log4j.properties</em> and <em>log4j2.properties</em> file but still it's not reading any of them.</p>
  <p>Could someone please help me to understand where I'm going wrong.</p>