-
-
Save cnestor/2c1658d67cf2997a5cc586c7fb0b7fb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "test" | |
version := "0.1" | |
scalaVersion := "2.12.3" | |
fork in run := true | |
libraryDependencies += "org.apache.logging.log4j" % "log4j-api" % "2.8.2" | |
libraryDependencies += "org.apache.logging.log4j" % "log4j-core" % "2.8.2" | |
libraryDependencies += "org.apache.logging.log4j" % "log4j-jul" % "2.8.2" | |
libraryDependencies += "com.lmax" % "disruptor" % "3.3.0" //required dependency of log4j async logger | |
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.12.3" //comment out to run smoothly | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Configuration status="DEBUG"> | |
</Configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] 2017-09-11 15:39:27,671 main DEBUG Initializing configuration XmlConfiguration[location=/Users/nestorcn/Desktop/Test/target/scala-2.12/classes/log4jconfig.xml] | |
[info] 2017-09-11 15:39:27,684 main DEBUG Installed script engines | |
[info] 2017-09-11 15:39:36,716 main DEBUG Scala REPL Version: 2.0, Language: Scala, Threading: Not Thread Safe, Compile: true, Names: {scala} | |
[info] 2017-09-11 15:39:36,838 main WARN JNDI lookup class is not available because this JRE does not support JNDI. JNDI string lookups will not be available, continuing configuration. Ignoring java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.lookup.JndiLookup to org.apache.logging.log4j.core.lookup.StrLookup | |
[info] 2017-09-11 15:39:36,842 main WARN JMX runtime input lookup class is not available because this JRE does not support JMX. JMX lookups will not be available, continuing configuration. Ignoring java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.lookup.JmxRuntimeInputArgumentsLookup to org.apache.logging.log4j.core.lookup.StrLookup | |
[info] 2017-09-11 15:39:36,844 main DEBUG Not in a ServletContext environment, thus not loading WebLookup plugin. | |
[info] 2017-09-11 15:39:36,845 main DEBUG PluginManager 'Converter' found 41 plugins | |
[info] 2017-09-11 15:39:36,846 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false-2 | |
[info] 2017-09-11 15:39:36,849 main DEBUG [AsyncContext@3006bfb] Starting AsyncLogger disruptor for this context with ringbufferSize=4096, waitStrategy=TimeoutBlockingWaitStrategy, exceptionHandler=org.apache.logging.log4j.core.async.AsyncLoggerDefaultExceptionHandler@4b9f7edc... | |
[info] 2017-09-11 15:39:36,855 main DEBUG Starting LoggerContext[name=AsyncContext@3006bfb, org.apache.logging.log4j.core.async.AsyncLoggerContext@22c29aa8]... | |
[info] 2017-09-11 15:39:36,859 main DEBUG Reconfiguration started for context[name=AsyncContext@3006bfb] at URI null (org.apache.logging.log4j.core.async.AsyncLoggerContext@22c29aa8) with optional ClassLoader: null | |
[info] 2017-09-11 15:39:36,865 main DEBUG Using configurationFactory org.apache.logging.log4j.core.config.ConfigurationFactory$Factory@129b69b2 | |
[info] 2017-09-11 15:39:36,867 main WARN JNDI lookup class is not available because this JRE does not support JNDI. JNDI string lookups will not be available, continuing configuration. Ignoring java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.lookup.JndiLookup to org.apache.logging.log4j.core.lookup.StrLookup | |
[info] 2017-09-11 15:39:36,869 main WARN JMX runtime input lookup class is not available because this JRE does not support JMX. JMX lookups will not be available, continuing configuration. Ignoring java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.lookup.JmxRuntimeInputArgumentsLookup to org.apache.logging.log4j.core.lookup.StrLookup | |
[info] 2017-09-11 15:39:36,873 main DEBUG Not in a ServletContext environment, thus not loading WebLookup plugin. | |
[info] 2017-09-11 15:39:36,884 main DEBUG Initializing configuration XmlConfiguration[location=/Users/nestorcn/Desktop/Test/target/scala-2.12/classes/log4jconfig.xml] | |
[info] 2017-09-11 15:39:36,989 main DEBUG Installed script engines | |
[error] Exception in thread "main" java.lang.ExceptionInInitializerError | |
[error] at jdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.<init>(MethodHandleFactory.java:325) | |
[error] at jdk.nashorn.internal.lookup.MethodHandleFactory.<clinit>(MethodHandleFactory.java:103) | |
[error] at jdk.nashorn.internal.runtime.Context.initLoggers(Context.java:1404) | |
[error] at jdk.nashorn.internal.runtime.Context.<init>(Context.java:549) | |
[error] at jdk.nashorn.internal.runtime.Context.<init>(Context.java:466) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:129) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:125) | |
[error] at java.security.AccessController.doPrivileged(Native Method) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngine.<init>(NashornScriptEngine.java:125) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(NashornScriptEngineFactory.java:148) | |
[error] at org.apache.logging.log4j.core.script.ScriptManager.<init>(ScriptManager.java:96) | |
[error] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:214) | |
[error] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) | |
[error] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) | |
[error] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) | |
[error] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) | |
[error] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) | |
[error] at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:76) | |
[error] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) | |
[error] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) | |
[error] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) | |
[error] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) | |
[error] at org.apache.logging.log4j.jul.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:34) | |
[error] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) | |
[error] at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89) | |
[error] at java.util.logging.LogManager.demandLogger(LogManager.java:551) | |
[error] at java.util.logging.Logger.demandLogger(Logger.java:455) | |
[error] at java.util.logging.Logger.getLogger(Logger.java:502) | |
[error] at com.lmax.disruptor.FatalExceptionHandler.<clinit>(FatalExceptionHandler.java:27) | |
[error] at com.lmax.disruptor.BatchEventProcessor.<init>(BatchEventProcessor.java:34) | |
[error] at com.lmax.disruptor.dsl.Disruptor.createEventProcessors(Disruptor.java:433) | |
[error] at com.lmax.disruptor.dsl.Disruptor.handleEventsWith(Disruptor.java:114) | |
[error] at org.apache.logging.log4j.core.async.AsyncLoggerDisruptor.start(AsyncLoggerDisruptor.java:99) | |
[error] at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:75) | |
[error] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) | |
[error] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) | |
[error] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) | |
[error] at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551) | |
[error] at test.Test$.delayedEndpoint$test$Test$1(Test.scala:9) | |
[error] at test.Test$delayedInit$body.apply(Test.scala:5) | |
[error] at scala.Function0.apply$mcV$sp(Function0.scala:34) | |
[error] at scala.Function0.apply$mcV$sp$(Function0.scala:34) | |
[error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) | |
[error] at scala.App.$anonfun$main$1$adapted(App.scala:76) | |
[error] at scala.collection.immutable.List.foreach(List.scala:389) | |
[error] at scala.App.main(App.scala:76) | |
[error] at scala.App.main$(App.scala:74) | |
[error] at test.Test$.main(Test.scala:5) | |
[error] at test.Test.main(Test.scala) | |
[error] Caused by: java.lang.NullPointerException | |
[error] at jdk.nashorn.internal.runtime.Context.initLoggers(Context.java:1404) | |
[error] at jdk.nashorn.internal.runtime.Context.<init>(Context.java:549) | |
[error] at jdk.nashorn.internal.runtime.Context.<init>(Context.java:466) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:129) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:125) | |
[error] at java.security.AccessController.doPrivileged(Native Method) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngine.<init>(NashornScriptEngine.java:125) | |
[error] at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(NashornScriptEngineFactory.java:148) | |
[error] at org.apache.logging.log4j.core.script.ScriptManager.<init>(ScriptManager.java:96) | |
[error] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:214) | |
[error] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) | |
[error] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) | |
[error] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) | |
[error] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) | |
[error] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) | |
[error] at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:76) | |
[error] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) | |
[error] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) | |
[error] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) | |
[error] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) | |
[error] at org.apache.logging.log4j.jul.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:34) | |
[error] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) | |
[error] at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89) | |
[error] at java.util.logging.LogManager.demandLogger(LogManager.java:551) | |
[error] at java.util.logging.Logger.demandLogger(Logger.java:455) | |
[error] at java.util.logging.Logger.getLogger(Logger.java:502) | |
[error] at jdk.nashorn.internal.runtime.logging.DebugLogger.instantiateLogger(DebugLogger.java:84) | |
[error] at jdk.nashorn.internal.runtime.logging.DebugLogger.<init>(DebugLogger.java:77) | |
[error] at jdk.nashorn.internal.runtime.logging.DebugLogger.<clinit>(DebugLogger.java:55) | |
[error] ... 49 more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.logging.log4j.LogManager | |
object Test extends App { | |
System.setProperty("log4j.configurationFile", "log4jconfig.xml") | |
System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager") | |
System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector") | |
val log = LogManager.getLogger(this.getClass) | |
log.info("logging") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment