Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove annoying logger error in scripted #436

Closed
jvican opened this issue Oct 16, 2017 · 2 comments
Closed

Remove annoying logger error in scripted #436

jvican opened this issue Oct 16, 2017 · 2 comments

Comments

@jvican
Copy link
Member

jvican commented Oct 16, 2017

Run scripted. You'll see:

ERROR StatusLogger Unable to create custom ContextSelector. Falling back to default.
 java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.async.AsyncLoggerContextSelector to org.apache.logging.log4j.core.selector.ContextSelector
	at java.lang.Class.cast(Class.java:3369)
	at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:201)
	at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOfProperty(LoaderUtil.java:226)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.createContextSelector(Log4jContextFactory.java:97)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:58)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:94)
	at org.apache.logging.log4j.spi.ThreadContextMapFactory.createThreadContextMap(ThreadContextMapFactory.java:73)
	at org.apache.logging.log4j.ThreadContext.init(ThreadContext.java:223)
	at org.apache.logging.log4j.ThreadContext.<clinit>(ThreadContext.java:202)
	at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createDefaultInjector(ContextDataInjectorFactory.java:83)
	at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createInjector(ContextDataInjectorFactory.java:67)
	at org.apache.logging.log4j.core.lookup.ContextMapLookup.<init>(ContextMapLookup.java:34)
	at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:117)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:125)
	at org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration.<init>(BuiltConfiguration.java:58)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:170)
	at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:159)
	at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:55)
	at sbt.util.LogExchange.init(LogExchange.scala:102)
	at sbt.util.LogExchange.context$lzycompute(LogExchange.scala:17)
	at sbt.util.LogExchange.context(LogExchange.scala:17)
	at sbt.util.LogExchange.dummyLayout$lzycompute(LogExchange.scala:57)
	at sbt.util.LogExchange.dummyLayout(LogExchange.scala:56)
	at sbt.internal.util.ConsoleAppender.<init>(ConsoleAppender.scala:270)
	at sbt.internal.util.ConsoleAppender$.apply(ConsoleAppender.scala:192)
	at sbt.internal.util.ConsoleAppender$.apply(ConsoleAppender.scala:175)
	at sbt.internal.util.ConsoleAppender$.apply(ConsoleAppender.scala:153)
	at sbt.internal.util.ConsoleAppender$.apply(ConsoleAppender.scala:136)
	at sbt.internal.util.ConsoleAppender$.apply(ConsoleAppender.scala:112)
	at sbt.internal.scripted.ScriptedTests.<init>(ScriptedTests.scala:49)
	at sbt.internal.scripted.ScriptedRunnerImpl$.run(ScriptedTests.scala:16)
	at sbt.internal.inc.IncScriptedRunner.$anonfun$run$1(IncScriptedRunner.scala:20)
	at sbt.internal.inc.IncScriptedRunner.$anonfun$run$1$adapted(IncScriptedRunner.scala:17)
	at sbt.io.IO$.withTemporaryDirectory(IO.scala:332)
	at sbt.io.IO$.withTemporaryDirectory(IO.scala:340)
	at sbt.internal.inc.IncScriptedRunner.run(IncScriptedRunner.scala:17)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at Scripted$.doScripted(Scripted.scala:83)
	at BuildImplementation$BuildDefaults$.$anonfun$zincScripted$5(BuildPlugin.scala:322)
	at BuildImplementation$BuildDefaults$.$anonfun$zincScripted$5$adapted(BuildPlugin.scala:307)
	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
	at sbt.std.Transform$$anon$4.work(System.scala:64)
	at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
	at sbt.Execute.work(Execute.scala:266)
	at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

I can reproduce in both CI and my local machine.

Does anyone in the sbt team know why this is happening? I've done some debugging and it seems that everything happens in this line of ScriptedRunnerImpl: https://gist.github.com/jvican/499c4a6446cc55bd7bbd8c8dc67d969a#file-scriptedtests-scala-L4. However, the logger setup is unknown to me, so cannot move forward.

@jvican
Copy link
Member Author

jvican commented Oct 20, 2017

The lack of this line in the scripted plugin used by Zinc must have something to do with this error: https://github.com/scalacenter/sbt/blob/4ce4fb72bde3b8acfaf526b79d32ca1463bc687b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala#L319-L320

jvican added a commit to scalacenter/zinc that referenced this issue Oct 22, 2017
jvican added a commit to scalacenter/zinc that referenced this issue Oct 22, 2017
jvican added a commit to scalacenter/zinc that referenced this issue Oct 22, 2017
jvican added a commit to scalacenter/zinc that referenced this issue Oct 22, 2017
dwijnand added a commit that referenced this issue Oct 25, 2017
Fix #436: Remove annoying log4j scripted exception
@jvican
Copy link
Member Author

jvican commented Oct 26, 2017

Weird... this didn't get closed after the merge.

@jvican jvican closed this as completed Oct 26, 2017
dwijnand added a commit to dwijnand/zinc that referenced this issue Nov 22, 2017
* 1.0.x: (25 commits)
  Add yourkit acknoledgement in the README
  Add header to cached hashing spec
  Add headers to missing files
  Fix sbt#332: Add sbt-header back to the build
  Update sbt-scalafmt to 1.12
  Make classpath hashing more lightweight
  Fix sbt#442: Name hash of value class should include underlying type
  source-dependencies/value-class-underlying: fix test
  Ignore null in generic lambda tparams
  Improve and make scripted parallel
  Fix sbt#436: Remove annoying log4j scripted exception
  Fix sbt#127: Use `unexpanded` name instead of `name`
  Add pending test case for issue/127
  source-dependencies / patMat-scope workaround
  Fixes undercompilation on inheritance on same source
  Add real reproduction case for sbt#417
  Add trait-trait-212 for Scala 2.12.3
  Fix source-dependencies/sealed
  Import statement no longer needed
  Move mima exclusions to its own file
  ...

 Conflicts:
	internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala
	zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala

The ClassToAPI conflict is due to:
* sbt#393 (a 1.x PR), conflicting with
* sbt#446 (a 1.0.x PR).

The MixedAnalyzingCompiler conflict is due to:
* sbt#427 (a 1.x PR), conflicting with
* sbt#452 (a 1.0.x PR).
dwijnand added a commit to dwijnand/zinc that referenced this issue Nov 23, 2017
* 1.0.x: (28 commits)
  Split compiler bridge tests to another subproject
  Implement compiler bridge for 2.13.0-M2
  Add yourkit acknoledgement in the README
  "sbt '++ 2.13.0-M2!' compile" does not work with sbt 1.0.0
  Add header to cached hashing spec
  Add headers to missing files
  Fix sbt#332: Add sbt-header back to the build
  Update sbt-scalafmt to 1.12
  Make classpath hashing more lightweight
  Fix sbt#442: Name hash of value class should include underlying type
  source-dependencies/value-class-underlying: fix test
  Ignore null in generic lambda tparams
  Improve and make scripted parallel
  Fix sbt#436: Remove annoying log4j scripted exception
  Fix sbt#127: Use `unexpanded` name instead of `name`
  Add pending test case for issue/127
  source-dependencies / patMat-scope workaround
  Fixes undercompilation on inheritance on same source
  Add real reproduction case for sbt#417
  Add trait-trait-212 for Scala 2.12.3
  ...

 Conflicts:
	internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala
	project/build.properties
	zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala

The ClassToAPI conflict is due to:
* sbt#393 (a 1.x PR), conflicting with
* sbt#446 (a 1.0.x PR).

The build.properties conflict is due to different PRs bumping
sbt.version from 1.0.0 to 1.0.2 to 1.0.3. (sbt#413, sbt#418, sbt#453).

The MixedAnalyzingCompiler conflict is due to:
* sbt#427 (a 1.x PR), conflicting with
* sbt#452 (a 1.0.x PR).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants