diff --git a/engine/interpreter-dsl-test/src/test/java/org/enso/interpreter/dsl/test/ThrowableCatchTest.java b/engine/interpreter-dsl-test/src/test/java/org/enso/interpreter/dsl/test/ThrowableCatchTest.java index b980fe05aeca..c54c3d1ebbf7 100644 --- a/engine/interpreter-dsl-test/src/test/java/org/enso/interpreter/dsl/test/ThrowableCatchTest.java +++ b/engine/interpreter-dsl-test/src/test/java/org/enso/interpreter/dsl/test/ThrowableCatchTest.java @@ -8,6 +8,8 @@ import java.nio.file.Paths; import java.util.List; import java.util.function.Supplier; +import java.util.logging.Level; + import org.enso.interpreter.EnsoLanguage; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.function.Function; @@ -68,8 +70,12 @@ public void setup() { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .logHandler(System.err) .option(RuntimeOptions.STRICT_ERRORS, "true") + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) diff --git a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/AvoidIdInstrumentationTagTest.java b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/AvoidIdInstrumentationTagTest.java index 1c9eee06e48c..0639a47f7a98 100644 --- a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/AvoidIdInstrumentationTagTest.java +++ b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/AvoidIdInstrumentationTagTest.java @@ -7,6 +7,8 @@ import java.nio.file.Paths; import java.util.Map; import java.util.function.Predicate; +import java.util.logging.Level; + import org.enso.interpreter.node.ClosureRootNode; import org.enso.interpreter.runtime.tag.AvoidIdInstrumentationTag; import org.enso.interpreter.runtime.tag.IdentifiedTag; @@ -38,7 +40,11 @@ public void initContext() { RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath() ) - .logHandler(OutputStream.nullOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) diff --git a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/WarningInstrumentationTest.java b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/WarningInstrumentationTest.java index 16b508802ce3..5e23f6cbd1d2 100644 --- a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/WarningInstrumentationTest.java +++ b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/WarningInstrumentationTest.java @@ -21,6 +21,7 @@ import java.io.OutputStream; import java.nio.file.Paths; import java.util.Map; +import java.util.logging.Level; public class WarningInstrumentationTest { @@ -35,7 +36,11 @@ public void initContext() { RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath() ) - .logHandler(OutputStream.nullOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala index 2aaeca73238a..4e2ddb246fad 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/BuiltinTypesTest.scala @@ -15,6 +15,7 @@ import org.scalatest.matchers.should.Matchers import java.io.{ByteArrayOutputStream, File} import java.nio.file.{Files, Path, Paths} import java.util.UUID +import java.util.logging.Level @scala.annotation.nowarn("msg=multiarg infix syntax") class BuiltinTypesTest @@ -36,15 +37,14 @@ class BuiltinTypesTest val pkg: Package[File] = PackageManager.Default.create(tmpDir.toFile, packageName, "Enso_Test") - val out: ByteArrayOutputStream = new ByteArrayOutputStream() - val logOut: ByteArrayOutputStream = new ByteArrayOutputStream() + val out: ByteArrayOutputStream = new ByteArrayOutputStream() val executionContext = new PolyglotContext( Context .newBuilder(LanguageInfo.ID) .allowExperimentalOptions(true) .allowAllAccess(true) .option(RuntimeOptions.PROJECT_ROOT, pkg.root.getAbsolutePath) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .option(RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "true") .option(RuntimeOptions.ENABLE_PROJECT_SUGGESTIONS, "false") .option(RuntimeOptions.ENABLE_GLOBAL_SUGGESTIONS, "false") @@ -63,7 +63,7 @@ class BuiltinTypesTest .getAbsolutePath ) .option(RuntimeOptions.EDITION_OVERRIDE, "0.0.0-dev") - .logHandler(logOut) + .logHandler(System.err) .out(out) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeAsyncCommandsTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeAsyncCommandsTest.scala index 876c8744a5e9..7f8c2d632420 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeAsyncCommandsTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeAsyncCommandsTest.scala @@ -15,6 +15,7 @@ import org.scalatest.matchers.should.Matchers import java.io.{ByteArrayOutputStream, File} import java.nio.file.{Files, Path, Paths} import java.util.UUID +import java.util.logging.Level @scala.annotation.nowarn("msg=multiarg infix syntax") class RuntimeAsyncCommandsTest @@ -42,7 +43,7 @@ class RuntimeAsyncCommandsTest .allowExperimentalOptions(true) .allowAllAccess(true) .option(RuntimeOptions.PROJECT_ROOT, pkg.root.getAbsolutePath) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName) .option( RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "false" @@ -65,6 +66,7 @@ class RuntimeAsyncCommandsTest ) .option(RuntimeOptions.EDITION_OVERRIDE, "0.0.0-dev") .out(out) + .logHandler(System.err) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() ) diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeComponentsTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeComponentsTest.scala index 5d8c0c2208b5..fdfe76fed268 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeComponentsTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeComponentsTest.scala @@ -27,7 +27,7 @@ import java.io.{ByteArrayOutputStream, File} import java.nio.file.{Files, Path, Paths} import java.util.UUID import java.util.concurrent.{LinkedBlockingQueue, TimeUnit} - +import java.util.logging.Level import scala.concurrent.duration._ @scala.annotation.nowarn("msg=multiarg infix syntax") @@ -125,7 +125,7 @@ class RuntimeComponentsTest RuntimeOptions.LANGUAGE_HOME_OVERRIDE, distributionHome.toString ) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName) .option(RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "true") .option(RuntimeServerInfo.ENABLE_OPTION, "true") .option(RuntimeOptions.INTERACTIVE_MODE, "true") @@ -134,6 +134,7 @@ class RuntimeComponentsTest InstrumentTestContext.DISABLE_IR_CACHE ) .out(out) + .logHandler(System.err) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() ) diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeExecutionEnvironmentTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeExecutionEnvironmentTest.scala index d5a6d375d546..8558f16e6314 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeExecutionEnvironmentTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeExecutionEnvironmentTest.scala @@ -18,7 +18,7 @@ import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} import java.io.{ByteArrayOutputStream, File} import java.nio.file.{Files, Path, Paths} import java.util.UUID - +import java.util.logging.Level import scala.concurrent.duration._ @scala.annotation.nowarn("msg=multiarg infix syntax") @@ -59,8 +59,7 @@ class RuntimeExecutionEnvironmentTest "Enso_Test", edition = Some(edition) ) - val out: ByteArrayOutputStream = new ByteArrayOutputStream() - val logOut: ByteArrayOutputStream = new ByteArrayOutputStream() + val out: ByteArrayOutputStream = new ByteArrayOutputStream() val executionContext = new PolyglotContext( Context .newBuilder(LanguageInfo.ID) @@ -71,7 +70,7 @@ class RuntimeExecutionEnvironmentTest RuntimeOptions.LANGUAGE_HOME_OVERRIDE, distributionHome.toString ) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .option(RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "true") .option(RuntimeOptions.ENABLE_PROJECT_SUGGESTIONS, "false") .option(RuntimeOptions.ENABLE_GLOBAL_SUGGESTIONS, "false") @@ -82,7 +81,7 @@ class RuntimeExecutionEnvironmentTest RuntimeOptions.DISABLE_IR_CACHES, InstrumentTestContext.DISABLE_IR_CACHE ) - //.logHandler(logOut) + .logHandler(System.err) .out(out) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeInstrumentTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeInstrumentTest.scala index 62d12218b00d..f74b4e2ea779 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeInstrumentTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeInstrumentTest.scala @@ -63,6 +63,7 @@ class RuntimeInstrumentTest ) .option(RuntimeOptions.EDITION_OVERRIDE, "0.0.0-dev") .out(out) + .logHandler(System.err) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() ) diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeProjectContextTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeProjectContextTest.scala index 86f0b8d8a190..50fbf6279c7c 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeProjectContextTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeProjectContextTest.scala @@ -6,6 +6,7 @@ import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec import java.nio.file.Paths +import java.util.logging.Level class RuntimeProjectContextTest extends AnyWordSpec with Matchers { "Runtime Context" should { @@ -28,7 +29,8 @@ class RuntimeProjectContextTest extends AnyWordSpec with Matchers { .getAbsolutePath ) .option(RuntimeOptions.EDITION_OVERRIDE, "0.0.0-dev") - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName) + .logHandler(System.err) .build() context.initialize(LanguageInfo.ID) } diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeRefactoringTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeRefactoringTest.scala index 0fc56c6b06b8..357c57df1c99 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeRefactoringTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeRefactoringTest.scala @@ -19,6 +19,7 @@ import org.scalatest.matchers.should.Matchers import java.io.{ByteArrayOutputStream, File} import java.nio.file.{Files, Path, Paths} import java.util.UUID +import java.util.logging.Level @scala.annotation.nowarn("msg=multiarg infix syntax") class RuntimeRefactoringTest @@ -48,7 +49,7 @@ class RuntimeRefactoringTest .allowExperimentalOptions(true) .allowAllAccess(true) .option(RuntimeOptions.PROJECT_ROOT, pkg.root.getAbsolutePath) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .option(RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "true") .option(RuntimeOptions.ENABLE_PROJECT_SUGGESTIONS, "false") .option(RuntimeOptions.ENABLE_GLOBAL_SUGGESTIONS, "false") diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeStdlibTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeStdlibTest.scala index baf046d87e30..5512a8e75140 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeStdlibTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeStdlibTest.scala @@ -17,7 +17,7 @@ import java.io.{ByteArrayOutputStream, File} import java.nio.file.{Files, Path, Paths} import java.util.UUID import java.util.concurrent.{LinkedBlockingQueue, TimeUnit} - +import java.util.logging.Level import scala.collection.mutable import scala.concurrent.duration._ @@ -73,7 +73,7 @@ class RuntimeStdlibTest RuntimeOptions.LANGUAGE_HOME_OVERRIDE, distributionHome.toString ) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName) .option(RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "true") .option(RuntimeServerInfo.ENABLE_OPTION, "true") .option(RuntimeOptions.INTERACTIVE_MODE, "true") @@ -82,6 +82,7 @@ class RuntimeStdlibTest InstrumentTestContext.DISABLE_IR_CACHE ) .out(out) + .logHandler(System.err) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() ) diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeSuggestionUpdatesTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeSuggestionUpdatesTest.scala index d9c3b1e796f1..b6c68eec6ec0 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeSuggestionUpdatesTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeSuggestionUpdatesTest.scala @@ -17,6 +17,7 @@ import org.scalatest.matchers.should.Matchers import java.io.{ByteArrayOutputStream, File} import java.nio.file.{Files, Path, Paths} import java.util.UUID +import java.util.logging.Level @scala.annotation.nowarn("msg=multiarg infix syntax") class RuntimeSuggestionUpdatesTest @@ -43,7 +44,7 @@ class RuntimeSuggestionUpdatesTest .allowExperimentalOptions(true) .allowAllAccess(true) .option(RuntimeOptions.PROJECT_ROOT, pkg.root.getAbsolutePath) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName) .option(RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "true") .option(RuntimeOptions.ENABLE_GLOBAL_SUGGESTIONS, "false") .option( @@ -61,6 +62,7 @@ class RuntimeSuggestionUpdatesTest ) .option(RuntimeOptions.EDITION_OVERRIDE, "0.0.0-dev") .out(out) + .logHandler(System.err) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() ) diff --git a/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/InsightForEnsoTest.java b/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/InsightForEnsoTest.java index 9517f1b19603..78a6a29ea4bb 100644 --- a/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/InsightForEnsoTest.java +++ b/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/InsightForEnsoTest.java @@ -5,6 +5,8 @@ import java.nio.file.Paths; import java.util.Map; import java.util.function.Function; +import java.util.logging.Level; + import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Language; @@ -30,7 +32,11 @@ public void initContext() throws Exception { RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath() ) - .logHandler(OutputStream.nullOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .out(out) diff --git a/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/instrument/VerifyJavaScriptIsAvailableTest.java b/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/instrument/VerifyJavaScriptIsAvailableTest.java index d9caa382207a..31d8545d2a87 100644 --- a/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/instrument/VerifyJavaScriptIsAvailableTest.java +++ b/engine/runtime-with-polyglot/src/test/java/org/enso/interpreter/test/instrument/VerifyJavaScriptIsAvailableTest.java @@ -4,6 +4,7 @@ import static org.junit.Assert.assertNotNull; import java.nio.file.Paths; +import java.util.logging.Level; import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.io.IOAccess; @@ -26,7 +27,7 @@ public static void initEnsoContext() { .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) - .option("log.level", "FINE") + .option(RuntimeOptions.LOG_LEVEL, Level.FINE.getName()) .logHandler(handler) .allowAllAccess(true) .build(); diff --git a/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala b/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala index 35973e6c6fab..7110f94e78be 100644 --- a/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala +++ b/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala @@ -18,6 +18,7 @@ import java.io.{ByteArrayOutputStream, File} import java.nio.charset.StandardCharsets import java.nio.file.{Files, Path, Paths} import java.util.UUID +import java.util.logging.Level @scala.annotation.nowarn("msg=multiarg infix syntax") class RuntimeVisualizationsTest @@ -38,15 +39,14 @@ class RuntimeVisualizationsTest val pkg: Package[File] = PackageManager.Default.create(tmpDir.toFile, packageName, "Enso_Test") - val out: ByteArrayOutputStream = new ByteArrayOutputStream() - val logOut: ByteArrayOutputStream = new ByteArrayOutputStream() + val out: ByteArrayOutputStream = new ByteArrayOutputStream() val executionContext = new PolyglotContext( Context .newBuilder() .allowExperimentalOptions(true) .allowAllAccess(true) .option(RuntimeOptions.PROJECT_ROOT, pkg.root.getAbsolutePath) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .option(RuntimeOptions.INTERPRETER_SEQUENTIAL_COMMAND_EXECUTION, "true") .option(RuntimeOptions.ENABLE_PROJECT_SUGGESTIONS, "false") .option(RuntimeOptions.ENABLE_GLOBAL_SUGGESTIONS, "false") @@ -61,7 +61,7 @@ class RuntimeVisualizationsTest RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile.getAbsolutePath ) - .logHandler(logOut) + .logHandler(System.err) .out(out) .serverTransport(runtimeServerEmulator.makeServerTransport) .build() diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java index e81288ee03c4..1bf521d840a1 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java @@ -4,6 +4,9 @@ import java.nio.file.Paths; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.logging.Level; + +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Engine; import org.graalvm.polyglot.Value; @@ -35,7 +38,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { Engine eng = Engine.newBuilder() .allowExperimentalOptions(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option( "enso.languageHomeOverride", Paths.get("../../distribution/component").toFile().getAbsolutePath()) diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/CurriedFunctionBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/CurriedFunctionBenchmarks.java index b181a2e425dc..e011eabffcb9 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/CurriedFunctionBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/CurriedFunctionBenchmarks.java @@ -4,6 +4,9 @@ import java.nio.file.Paths; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.logging.Level; + +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -35,7 +38,11 @@ public class CurriedFunctionBenchmarks { public void initializeBenchmark(BenchmarkParams params) throws Exception { var ctx = Context.newBuilder() .allowExperimentalOptions(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .allowIO(IOAccess.ALL) .allowAllAccess(true) .option( diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/EqualsBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/EqualsBenchmarks.java index 8211724eba35..1465ed73cc7c 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/EqualsBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/EqualsBenchmarks.java @@ -9,7 +9,10 @@ import java.util.Random; import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; + import org.enso.polyglot.MethodNames.Module; +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -61,7 +64,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { var ctx = Context.newBuilder() .allowExperimentalOptions(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .allowIO(IOAccess.ALL) .allowAllAccess(true) .option( diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/IfVsCaseBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/IfVsCaseBenchmarks.java index 5c5070127dcf..319c9e4de6a4 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/IfVsCaseBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/IfVsCaseBenchmarks.java @@ -8,9 +8,11 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; import org.enso.interpreter.test.TestBase; import org.enso.polyglot.MethodNames.Module; +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -43,13 +45,17 @@ public class IfVsCaseBenchmarks extends TestBase { private Value caseBench6; private Value createVec; private Value inputVec; - private OutputStream out = new ByteArrayOutputStream(); @Setup public void initializeBench(BenchmarkParams params) throws IOException { + OutputStream out = new ByteArrayOutputStream(); ctx = Context.newBuilder("enso") .allowAllAccess(true) - .logHandler(out) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .out(out) .err(out) .allowIO(IOAccess.ALL) diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ListBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ListBenchmarks.java index 8c3051c428ec..c2927dea54d1 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ListBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/ListBenchmarks.java @@ -4,6 +4,9 @@ import java.nio.file.Paths; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.logging.Level; + +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -42,7 +45,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option( "enso.languageHomeOverride", Paths.get("../../distribution/component").toFile().getAbsolutePath() diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/NestedPatternCompilationBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/NestedPatternCompilationBenchmarks.java index 36a7ddf4843f..d1a4c326a771 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/NestedPatternCompilationBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/NestedPatternCompilationBenchmarks.java @@ -6,6 +6,9 @@ import java.util.AbstractList; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.logging.Level; + +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -41,7 +44,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option( "enso.languageHomeOverride", Paths.get("../../distribution/component").toFile().getAbsolutePath() diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/SieveBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/SieveBenchmarks.java index 753a6fb138c9..9b2e04a8f24f 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/SieveBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/SieveBenchmarks.java @@ -3,6 +3,9 @@ import java.io.ByteArrayOutputStream; import java.nio.file.Paths; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; + +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -35,7 +38,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option( "enso.languageHomeOverride", Paths.get("../../distribution/component").toFile().getAbsolutePath() diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/StringBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/StringBenchmarks.java index 40046af9e879..a8cdb97c9684 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/StringBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/StringBenchmarks.java @@ -4,6 +4,9 @@ import java.nio.file.Paths; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.logging.Level; + +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -38,7 +41,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option( "enso.languageHomeOverride", Paths.get("../../distribution/component").toFile().getAbsolutePath() diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/TypePatternBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/TypePatternBenchmarks.java index 7ebd0faeecf5..e73c6f32127b 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/TypePatternBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/TypePatternBenchmarks.java @@ -1,6 +1,7 @@ package org.enso.interpreter.bench.benchmarks.semantic; import org.enso.polyglot.MethodNames.Module; +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -12,6 +13,7 @@ import java.nio.file.Paths; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.logging.Level; @BenchmarkMode(Mode.AverageTime) @@ -31,7 +33,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option( "enso.languageHomeOverride", Paths.get("../../distribution/component").toFile().getAbsolutePath() diff --git a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/VectorBenchmarks.java b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/VectorBenchmarks.java index db62ab652f23..136428029582 100644 --- a/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/VectorBenchmarks.java +++ b/engine/runtime/src/bench/java/org/enso/interpreter/bench/benchmarks/semantic/VectorBenchmarks.java @@ -5,6 +5,9 @@ import java.util.AbstractList; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.util.logging.Level; + +import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.io.IOAccess; @@ -39,7 +42,11 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option( "enso.languageHomeOverride", Paths.get("../../distribution/component").toFile().getAbsolutePath() diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java index 8ff6478275ea..dca976e2af97 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java @@ -765,13 +765,14 @@ public PackageRepository getPackageRepository() { } /** - * Gets a logger for the specified class. + * Gets a logger for the specified class that is bound to this engine. + * Such logger may then be safely used in threads defined in a thread-pool. * - * @param klass the class to name log entries with + * @param clazz the class to name log entries with * @return a new logger for the specified {@code path} */ - public TruffleLogger getLogger(Class klass) { - return TruffleLogger.getLogger(LanguageInfo.ID, klass); + public TruffleLogger getLogger(Class clazz) { + return environment.getLogger(clazz); } /** diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/TruffleCompilerContext.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/TruffleCompilerContext.java index 32572b649582..00a42ede29b2 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/TruffleCompilerContext.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/TruffleCompilerContext.java @@ -37,14 +37,14 @@ final class TruffleCompilerContext implements CompilerContext { private final EnsoContext context; private final TruffleLogger loggerCompiler; - private final TruffleLogger loggerManager; + private final TruffleLogger loggerSerializationManager; private final RuntimeStubsGenerator stubsGenerator; private final SerializationManager serializationManager; TruffleCompilerContext(EnsoContext context) { this.context = context; this.loggerCompiler = context.getLogger(Compiler.class); - this.loggerManager = context.getLogger(SerializationManager.class); + this.loggerSerializationManager = context.getLogger(SerializationManager.class); this.serializationManager = new SerializationManager(this); this.stubsGenerator = new RuntimeStubsGenerator(context.getBuiltins()); } @@ -90,7 +90,7 @@ public void log(Level level, String msg, Object... args) { @Override public void logSerializationManager(Level level, String msg, Object... args) { - loggerManager.log(level, msg, args); + loggerSerializationManager.log(level, msg, args); } @Override diff --git a/engine/runtime/src/test/java/org/enso/compiler/ExecCompilerTest.java b/engine/runtime/src/test/java/org/enso/compiler/ExecCompilerTest.java index a41d9ffdc104..d1643b14af59 100644 --- a/engine/runtime/src/test/java/org/enso/compiler/ExecCompilerTest.java +++ b/engine/runtime/src/test/java/org/enso/compiler/ExecCompilerTest.java @@ -2,6 +2,7 @@ import java.io.OutputStream; import java.nio.file.Paths; +import java.util.logging.Level; import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; @@ -28,7 +29,11 @@ public static void initEnsoContext() { Paths.get("../../distribution/component").toFile().getAbsolutePath() ) .option(RuntimeOptions.STRICT_ERRORS, "false") - .logHandler(OutputStream.nullOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .allowAllAccess(true) .build(); assertNotNull("Enso language is supported", ctx.getEngine().getLanguages().get("enso")); diff --git a/engine/runtime/src/test/java/org/enso/compiler/SerdeCompilerTest.java b/engine/runtime/src/test/java/org/enso/compiler/SerdeCompilerTest.java index c4e19900ae82..851935a0f1ae 100644 --- a/engine/runtime/src/test/java/org/enso/compiler/SerdeCompilerTest.java +++ b/engine/runtime/src/test/java/org/enso/compiler/SerdeCompilerTest.java @@ -14,6 +14,7 @@ import java.util.concurrent.TimeoutException; import java.util.logging.Formatter; import java.util.logging.Handler; +import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.SimpleFormatter; import org.enso.compiler.core.ir.Module; @@ -118,6 +119,7 @@ private Context ensoContextForPackage(String name, File pkgFile, boolean disable .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .logHandler(mockHandler) .option("log.enso.org.enso.compiler.Compiler.level", "FINE") .allowAllAccess(true) diff --git a/engine/runtime/src/test/java/org/enso/compiler/SerializerTest.java b/engine/runtime/src/test/java/org/enso/compiler/SerializerTest.java index a0cc9aea4da2..1aa6cdd34ec9 100644 --- a/engine/runtime/src/test/java/org/enso/compiler/SerializerTest.java +++ b/engine/runtime/src/test/java/org/enso/compiler/SerializerTest.java @@ -5,9 +5,9 @@ import java.io.File; import java.io.IOException; -import java.io.OutputStream; import java.nio.file.Paths; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.SerializationManager; import org.enso.pkg.PackageManager; @@ -28,7 +28,8 @@ public Context ensoContextForPackage(String name, File pkgFile) throws IOExcepti .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) - .logHandler(OutputStream.nullOutputStream()) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) + .logHandler(System.err) .allowAllAccess(true) .build(); assertNotNull("Enso language is supported", ctx.getEngine().getLanguages().get("enso")); diff --git a/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleSourcesTest.java b/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleSourcesTest.java index d16286863355..c6717b2759eb 100644 --- a/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleSourcesTest.java +++ b/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleSourcesTest.java @@ -2,10 +2,10 @@ import static org.junit.Assert.assertTrue; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.file.Paths; +import java.util.logging.Level; import org.enso.polyglot.LanguageInfo; import org.enso.polyglot.MethodNames; import org.enso.polyglot.RuntimeOptions; @@ -29,7 +29,8 @@ public void prepareTest() throws IOException { Engine eng = Engine.newBuilder() .allowExperimentalOptions(true) - .logHandler(new ByteArrayOutputStream()) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) + .logHandler(System.err) .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) diff --git a/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleTest.java b/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleTest.java index 8b49260e1d62..4f287157e0e6 100644 --- a/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleTest.java +++ b/engine/runtime/src/test/java/org/enso/interpreter/runtime/ModuleTest.java @@ -2,10 +2,10 @@ import static org.junit.Assert.assertTrue; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.file.Paths; +import java.util.logging.Level; import org.enso.pkg.QualifiedName; import org.enso.polyglot.LanguageInfo; import org.enso.polyglot.MethodNames; @@ -29,7 +29,8 @@ public void prepareTest() throws IOException { Engine eng = Engine.newBuilder() .allowExperimentalOptions(true) - .logHandler(new ByteArrayOutputStream()) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) + .logHandler(System.err) .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) diff --git a/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java b/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java index 39356a709bde..fdda319f5ed3 100644 --- a/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java +++ b/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java @@ -13,6 +13,7 @@ import java.util.Queue; import java.util.Set; import java.util.TreeSet; +import java.util.logging.Level; import java.util.stream.Collectors; import org.enso.polyglot.MethodNames.Module; @@ -58,9 +59,9 @@ public void initContext() { ) .option( RuntimeOptions.LOG_LEVEL, - "FINEST" + Level.FINEST.getName() ) - .logHandler(OutputStream.nullOutputStream()) + .logHandler(System.err) .build(); context = Context.newBuilder() diff --git a/engine/runtime/src/test/java/org/enso/interpreter/test/SharedEngineTest.java b/engine/runtime/src/test/java/org/enso/interpreter/test/SharedEngineTest.java index 22db92511579..7f3f0bb42bcd 100644 --- a/engine/runtime/src/test/java/org/enso/interpreter/test/SharedEngineTest.java +++ b/engine/runtime/src/test/java/org/enso/interpreter/test/SharedEngineTest.java @@ -2,6 +2,7 @@ import java.io.ByteArrayOutputStream; import java.nio.file.Paths; +import java.util.logging.Level; import org.enso.polyglot.RuntimeOptions; import org.graalvm.polyglot.Context; @@ -18,10 +19,13 @@ public class SharedEngineTest extends TestBase { @BeforeClass public static void initializeSharedEngine() { - var out = new ByteArrayOutputStream(); sharedEngine = Engine.newBuilder() .allowExperimentalOptions(true) - .logHandler(out) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option(RuntimeOptions.STRICT_ERRORS, "true") .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, diff --git a/engine/runtime/src/test/java/org/enso/interpreter/test/TestBase.java b/engine/runtime/src/test/java/org/enso/interpreter/test/TestBase.java index e3f9575a2e03..e7140a9c91c0 100644 --- a/engine/runtime/src/test/java/org/enso/interpreter/test/TestBase.java +++ b/engine/runtime/src/test/java/org/enso/interpreter/test/TestBase.java @@ -9,11 +9,11 @@ import com.oracle.truffle.api.library.ExportMessage; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.nodes.RootNode; -import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.nio.file.Paths; import java.util.Map; import java.util.concurrent.Callable; +import java.util.logging.Level; import org.enso.interpreter.EnsoLanguage; import org.enso.polyglot.MethodNames.Module; import org.enso.polyglot.RuntimeOptions; @@ -44,7 +44,8 @@ protected static Context.Builder defaultContextBuilder(String... languages) { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) + .logHandler(System.err) .option(RuntimeOptions.STRICT_ERRORS, "true") .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, diff --git a/engine/runtime/src/test/scala/org/enso/compiler/test/ModifiedTest.scala b/engine/runtime/src/test/scala/org/enso/compiler/test/ModifiedTest.scala index b8038ee7cfc4..97c1c759cc3e 100644 --- a/engine/runtime/src/test/scala/org/enso/compiler/test/ModifiedTest.scala +++ b/engine/runtime/src/test/scala/org/enso/compiler/test/ModifiedTest.scala @@ -12,6 +12,7 @@ import org.scalatest.matchers.should.Matchers import java.io.{ByteArrayOutputStream, File, FileFilter} import java.nio.file.{Files, Paths, StandardCopyOption} +import java.util.logging.Level trait ModifiedTest extends AnyFlatSpec @@ -62,7 +63,7 @@ trait ModifiedTest .option(RuntimeOptions.DISABLE_IR_CACHES, "false") .out(output) .in(System.in) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .logHandler(System.err) .build() context.initialize(LanguageInfo.ID) diff --git a/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala b/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala index d3d4ada04223..5340ad923513 100644 --- a/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala +++ b/engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala @@ -17,6 +17,7 @@ import org.scalatest.wordspec.AnyWordSpecLike import java.io.{ByteArrayOutputStream, ObjectOutputStream} import java.nio.file.Paths +import java.util.logging.Level /** Tests a single package with multiple modules for import/export resolution. * Checks whether the exported symbols and defined entities metadata of the modules @@ -41,7 +42,7 @@ class ImportExportTest .allowCreateThread(false) .out(out) .err(out) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .option(RuntimeOptions.DISABLE_IR_CACHES, "true") .logHandler(System.err) .option( diff --git a/engine/runtime/src/test/scala/org/enso/interpreter/test/InterpreterTest.scala b/engine/runtime/src/test/scala/org/enso/interpreter/test/InterpreterTest.scala index d24c8558346c..19ffcb3ca6e3 100644 --- a/engine/runtime/src/test/scala/org/enso/interpreter/test/InterpreterTest.scala +++ b/engine/runtime/src/test/scala/org/enso/interpreter/test/InterpreterTest.scala @@ -28,6 +28,7 @@ import java.io.{ } import java.nio.file.Paths import java.util.UUID +import java.util.logging.Level case class LocationsInstrumenter(instrument: CodeLocationsTestInstrument) { var bindings: List[EventBinding[LocationsEventListener]] = List() @@ -122,7 +123,7 @@ class InterpreterContext( .allowCreateThread(false) .out(output) .err(err) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .option(RuntimeOptions.DISABLE_IR_CACHES, "true") .environment("NO_COLOR", "true") .logHandler(System.err) diff --git a/engine/runtime/src/test/scala/org/enso/interpreter/test/PackageTest.scala b/engine/runtime/src/test/scala/org/enso/interpreter/test/PackageTest.scala index 21b74a3ed25f..d41a3322aaf3 100644 --- a/engine/runtime/src/test/scala/org/enso/interpreter/test/PackageTest.scala +++ b/engine/runtime/src/test/scala/org/enso/interpreter/test/PackageTest.scala @@ -8,6 +8,7 @@ import org.scalatest.matchers.should.Matchers import java.io.{ByteArrayOutputStream, File} import java.nio.file.Paths +import java.util.logging.Level trait PackageTest extends AnyFlatSpec with Matchers with ValueEquality { val output = new ByteArrayOutputStream() @@ -35,7 +36,7 @@ trait PackageTest extends AnyFlatSpec with Matchers with ValueEquality { .option(RuntimeOptions.DISABLE_IR_CACHES, "true") .out(output) .in(System.in) - .option(RuntimeOptions.LOG_LEVEL, "WARNING") + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .logHandler(System.err) .build() context.initialize(LanguageInfo.ID) diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java index b4281bd41a2d..c37a9dbf4ea5 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java @@ -7,6 +7,7 @@ import java.net.URISyntaxException; import java.util.List; import java.util.Set; +import java.util.logging.Level; import java.util.stream.Collectors; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.FilerException; @@ -44,6 +45,7 @@ public class BenchProcessor extends AbstractProcessor { "import java.util.List;", "import java.util.Objects;", "import java.util.concurrent.TimeUnit;", + "import java.util.logging.Level;", "import org.openjdk.jmh.annotations.Benchmark;", "import org.openjdk.jmh.annotations.BenchmarkMode;", "import org.openjdk.jmh.annotations.Mode;", @@ -113,7 +115,11 @@ public boolean process(Set annotations, RoundEnvironment .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) - .logHandler(new ByteArrayOutputStream()) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) + .logHandler(System.err) .option(RuntimeOptions.PROJECT_ROOT, projectRootDir.getAbsolutePath()) .option(RuntimeOptions.LANGUAGE_HOME_OVERRIDE, ensoHomeOverride.getAbsolutePath()) .build()) { @@ -242,7 +248,8 @@ private void generateClassForGroup( out.println(" .allowExperimentalOptions(true)"); out.println(" .allowIO(IOAccess.ALL)"); out.println(" .allowAllAccess(true)"); - out.println(" .logHandler(new ByteArrayOutputStream())"); + out.println(" .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName())"); + out.println(" .logHandler(System.err)"); out.println(" .option("); out.println(" RuntimeOptions.LANGUAGE_HOME_OVERRIDE,"); out.println(" languageHomeOverride.getAbsolutePath()");