From 0ddc14175a9a38b323332024e1e2ab0186ec3c65 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Fri, 27 Oct 2023 17:24:02 +0200 Subject: [PATCH 1/5] Provide log level to prevent truffle logger crash Partial fix for Truffle logger crashes - context required log levels. With a suggested change of log level in `SerializationManager` `sbt:enso> runtime/testOnly *SerdeCompilerTest` now passes but `sbt:enso> runtime/test` ...will continue to fail in `SerdeCompilerTest`, which is really confusing. --- .../org/enso/interpreter/dsl/test/ThrowableCatchTest.java | 6 ++++++ .../test/instrument/AvoidIdInstrumentationTagTest.java | 6 ++++++ .../test/instrument/WarningInstrumentationTest.java | 5 +++++ .../interpreter/test/instrument/BuiltinTypesTest.scala | 3 ++- .../test/instrument/RuntimeExecutionEnvironmentTest.scala | 4 ++-- .../test/instrument/RuntimeRefactoringTest.scala | 3 ++- .../java/org/enso/interpreter/test/InsightForEnsoTest.java | 6 ++++++ .../test/instrument/VerifyJavaScriptIsAvailableTest.java | 3 ++- .../test/instrument/RuntimeVisualizationsTest.scala | 3 ++- .../bench/benchmarks/semantic/ArrayProxyBenchmarks.java | 7 +++++++ .../benchmarks/semantic/CurriedFunctionBenchmarks.java | 7 +++++++ .../bench/benchmarks/semantic/EqualsBenchmarks.java | 7 +++++++ .../bench/benchmarks/semantic/IfVsCaseBenchmarks.java | 6 ++++++ .../bench/benchmarks/semantic/ListBenchmarks.java | 7 +++++++ .../semantic/NestedPatternCompilationBenchmarks.java | 7 +++++++ .../bench/benchmarks/semantic/SieveBenchmarks.java | 7 +++++++ .../bench/benchmarks/semantic/StringBenchmarks.java | 7 +++++++ .../bench/benchmarks/semantic/TypePatternBenchmarks.java | 6 ++++++ .../bench/benchmarks/semantic/VectorBenchmarks.java | 7 +++++++ .../src/test/java/org/enso/compiler/ExecCompilerTest.java | 5 +++++ .../src/test/java/org/enso/compiler/SerdeCompilerTest.java | 2 ++ .../src/test/java/org/enso/compiler/SerializerTest.java | 2 ++ .../org/enso/interpreter/runtime/ModuleSourcesTest.java | 2 ++ .../test/java/org/enso/interpreter/runtime/ModuleTest.java | 2 ++ .../java/org/enso/interpreter/test/DebuggingEnsoTest.java | 3 ++- .../java/org/enso/interpreter/test/SharedEngineTest.java | 5 +++++ .../src/test/java/org/enso/interpreter/test/TestBase.java | 2 ++ .../test/scala/org/enso/compiler/test/ModifiedTest.scala | 3 ++- .../org/enso/compiler/test/semantic/ImportExportTest.scala | 3 ++- .../scala/org/enso/interpreter/test/InterpreterTest.scala | 3 ++- .../test/scala/org/enso/interpreter/test/PackageTest.scala | 3 ++- .../java/org/enso/benchmarks/processor/BenchProcessor.java | 7 +++++++ 32 files changed, 138 insertions(+), 11 deletions(-) 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..a9e0b1417ca8 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; @@ -70,6 +72,10 @@ public void setup() { .allowAllAccess(true) .logHandler(new ByteArrayOutputStream()) .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..9cd4a3ad4c22 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,6 +40,10 @@ public void initContext() { RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath() ) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(OutputStream.nullOutputStream()) .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) 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..8e384800b34f 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,6 +36,10 @@ public void initContext() { RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath() ) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(OutputStream.nullOutputStream()) .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) 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..04ab2db1da0f 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 @@ -44,7 +45,7 @@ class BuiltinTypesTest .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/RuntimeExecutionEnvironmentTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeExecutionEnvironmentTest.scala index d5a6d375d546..09266c30d8f2 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") @@ -71,7 +71,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") 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-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..8788725f5a30 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,6 +32,10 @@ public void initContext() throws Exception { RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath() ) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(OutputStream.nullOutputStream()) .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) 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..25b51b84291f 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 @@ -46,7 +47,7 @@ class RuntimeVisualizationsTest .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/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..431cb0212b9b 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,6 +38,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { Engine eng = Engine.newBuilder() .allowExperimentalOptions(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option( "enso.languageHomeOverride", 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..3f0bebb4c9e1 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,6 +38,10 @@ public class CurriedFunctionBenchmarks { public void initializeBenchmark(BenchmarkParams params) throws Exception { var ctx = Context.newBuilder() .allowExperimentalOptions(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .allowIO(IOAccess.ALL) .allowAllAccess(true) 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..d670aec8af74 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,6 +64,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { var ctx = Context.newBuilder() .allowExperimentalOptions(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .allowIO(IOAccess.ALL) .allowAllAccess(true) 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..d1b384754b78 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; @@ -49,6 +51,10 @@ public class IfVsCaseBenchmarks extends TestBase { public void initializeBench(BenchmarkParams params) throws IOException { ctx = Context.newBuilder("enso") .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(out) .out(out) .err(out) 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..01e494f6ec78 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,6 +45,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option( "enso.languageHomeOverride", 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..aa20cc7c849f 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,6 +44,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option( "enso.languageHomeOverride", 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..1393544d32de 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,6 +38,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option( "enso.languageHomeOverride", 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..c3658f08b40b 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,6 +41,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option( "enso.languageHomeOverride", 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..7d2bf6a36aa6 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,6 +33,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option( "enso.languageHomeOverride", 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..a872a5a4fe57 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,6 +42,10 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option( "enso.languageHomeOverride", 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..ab1f57c451e9 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,6 +29,10 @@ public static void initEnsoContext() { Paths.get("../../distribution/component").toFile().getAbsolutePath() ) .option(RuntimeOptions.STRICT_ERRORS, "false") + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(OutputStream.nullOutputStream()) .allowAllAccess(true) .build(); 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..85c0299f09e6 100644 --- a/engine/runtime/src/test/java/org/enso/compiler/SerializerTest.java +++ b/engine/runtime/src/test/java/org/enso/compiler/SerializerTest.java @@ -8,6 +8,7 @@ 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,6 +29,7 @@ public Context ensoContextForPackage(String name, File pkgFile) throws IOExcepti .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .logHandler(OutputStream.nullOutputStream()) .allowAllAccess(true) .build(); 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..ace0a945b64d 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 @@ -6,6 +6,7 @@ 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,6 +30,7 @@ public void prepareTest() throws IOException { Engine eng = Engine.newBuilder() .allowExperimentalOptions(true) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .logHandler(new ByteArrayOutputStream()) .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, 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..ba6276ce7b0f 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 @@ -6,6 +6,7 @@ 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,6 +30,7 @@ public void prepareTest() throws IOException { Engine eng = Engine.newBuilder() .allowExperimentalOptions(true) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .logHandler(new ByteArrayOutputStream()) .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, 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..37c175f2f605 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,7 +59,7 @@ public void initContext() { ) .option( RuntimeOptions.LOG_LEVEL, - "FINEST" + Level.FINEST.getName() ) .logHandler(OutputStream.nullOutputStream()) .build(); 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..a19b09f36b04 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; @@ -21,6 +22,10 @@ public static void initializeSharedEngine() { var out = new ByteArrayOutputStream(); sharedEngine = Engine.newBuilder() .allowExperimentalOptions(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(out) .option(RuntimeOptions.STRICT_ERRORS, "true") .option( 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..45b5d5d3c4bf 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 @@ -14,6 +14,7 @@ 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,6 +45,7 @@ protected static Context.Builder defaultContextBuilder(String... languages) { .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) .logHandler(new ByteArrayOutputStream()) .option(RuntimeOptions.STRICT_ERRORS, "true") .option( 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..e0814882a789 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,6 +115,10 @@ public boolean process(Set annotations, RoundEnvironment .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .allowAllAccess(true) + .option( + RuntimeOptions.LOG_LEVEL, + Level.WARNING.getName() + ) .logHandler(new ByteArrayOutputStream()) .option(RuntimeOptions.PROJECT_ROOT, projectRootDir.getAbsolutePath()) .option(RuntimeOptions.LANGUAGE_HOME_OVERRIDE, ensoHomeOverride.getAbsolutePath()) @@ -242,6 +248,7 @@ private void generateClassForGroup( out.println(" .allowExperimentalOptions(true)"); out.println(" .allowIO(IOAccess.ALL)"); out.println(" .allowAllAccess(true)"); + out.println(" .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName())"); out.println(" .logHandler(new ByteArrayOutputStream())"); out.println(" .option("); out.println(" RuntimeOptions.LANGUAGE_HOME_OVERRIDE,"); From 2b9b788ab35f3aadd731c6a1c5d0e184bbae10c2 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 30 Oct 2023 12:54:59 +0100 Subject: [PATCH 2/5] Use TruffleLogger bound to the engine TruffleLoggers bound to the context were problematic when being invoked in threads coming from a thread pool. By explicitly using a TruffleLogger that is bound to the engine we can prevent such illegal usage. --- .../org/enso/interpreter/runtime/EnsoContext.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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..ac6b78ca909e 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 @@ -774,6 +774,17 @@ public TruffleLogger getLogger(Class klass) { return TruffleLogger.getLogger(LanguageInfo.ID, klass); } + /** + * 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 clazz the class to name log entries with + * @return a new logger for the specified {@code path} + */ + public TruffleLogger getLoggerBoundToEngine(Class clazz) { + return environment.getLogger(clazz); + } + /** * Returns the current clock value and atomically increments the counter by * one. From 82d708905239b7968e4946ec7ab1d7a90b1fa7c1 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 30 Oct 2023 16:47:30 +0100 Subject: [PATCH 3/5] Don't ignore relevant logs Logs were often sent to null outpu stream or `ByteArrayOutputStream`, ending up in a black hole. We want to see the logs above the specific level because they are relevant to debugging problems. --- .../interpreter/dsl/test/ThrowableCatchTest.java | 2 +- .../instrument/AvoidIdInstrumentationTagTest.java | 2 +- .../test/instrument/WarningInstrumentationTest.java | 2 +- .../test/instrument/BuiltinTypesTest.scala | 5 ++--- .../test/instrument/RuntimeAsyncCommandsTest.scala | 4 +++- .../test/instrument/RuntimeComponentsTest.scala | 5 +++-- .../instrument/RuntimeExecutionEnvironmentTest.scala | 5 ++--- .../test/instrument/RuntimeInstrumentTest.scala | 1 + .../test/instrument/RuntimeProjectContextTest.scala | 4 +++- .../test/instrument/RuntimeStdlibTest.scala | 5 +++-- .../instrument/RuntimeSuggestionUpdatesTest.scala | 4 +++- .../enso/interpreter/test/InsightForEnsoTest.java | 2 +- .../test/instrument/RuntimeVisualizationsTest.scala | 5 ++--- .../benchmarks/semantic/ArrayProxyBenchmarks.java | 2 +- .../semantic/CurriedFunctionBenchmarks.java | 2 +- .../bench/benchmarks/semantic/EqualsBenchmarks.java | 2 +- .../benchmarks/semantic/IfVsCaseBenchmarks.java | 1 - .../bench/benchmarks/semantic/ListBenchmarks.java | 2 +- .../semantic/NestedPatternCompilationBenchmarks.java | 2 +- .../bench/benchmarks/semantic/SieveBenchmarks.java | 2 +- .../bench/benchmarks/semantic/StringBenchmarks.java | 2 +- .../benchmarks/semantic/TypePatternBenchmarks.java | 2 +- .../bench/benchmarks/semantic/VectorBenchmarks.java | 2 +- .../org/enso/interpreter/runtime/EnsoContext.java | 12 +----------- .../java/org/enso/compiler/ExecCompilerTest.java | 2 +- .../test/java/org/enso/compiler/SerializerTest.java | 3 +-- .../enso/interpreter/runtime/ModuleSourcesTest.java | 3 +-- .../org/enso/interpreter/runtime/ModuleTest.java | 3 +-- .../org/enso/interpreter/test/DebuggingEnsoTest.java | 2 +- .../org/enso/interpreter/test/SharedEngineTest.java | 3 +-- .../java/org/enso/interpreter/test/TestBase.java | 3 +-- .../enso/benchmarks/processor/BenchProcessor.java | 4 ++-- 32 files changed, 45 insertions(+), 55 deletions(-) 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 a9e0b1417ca8..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 @@ -70,7 +70,7 @@ 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, 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 9cd4a3ad4c22..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 @@ -44,7 +44,7 @@ public void initContext() { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(OutputStream.nullOutputStream()) + .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 8e384800b34f..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 @@ -40,7 +40,7 @@ public void initContext() { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(OutputStream.nullOutputStream()) + .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 04ab2db1da0f..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 @@ -37,8 +37,7 @@ 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) @@ -64,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 09266c30d8f2..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 @@ -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) @@ -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/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 8788725f5a30..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 @@ -36,7 +36,7 @@ public void initContext() throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(OutputStream.nullOutputStream()) + .logHandler(System.err) .allowExperimentalOptions(true) .allowIO(IOAccess.ALL) .out(out) 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 25b51b84291f..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 @@ -39,8 +39,7 @@ 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() @@ -62,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 431cb0212b9b..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 @@ -42,7 +42,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 3f0bebb4c9e1..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 @@ -42,7 +42,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 d670aec8af74..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 @@ -68,7 +68,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 d1b384754b78..ce00dfbf7913 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 @@ -45,7 +45,6 @@ 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 { 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 01e494f6ec78..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 @@ -49,7 +49,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 aa20cc7c849f..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 @@ -48,7 +48,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 1393544d32de..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 @@ -42,7 +42,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 c3658f08b40b..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 @@ -45,7 +45,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 7d2bf6a36aa6..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 @@ -37,7 +37,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 a872a5a4fe57..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 @@ -46,7 +46,7 @@ public void initializeBenchmark(BenchmarkParams params) throws Exception { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .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 ac6b78ca909e..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 @@ -764,16 +764,6 @@ public PackageRepository getPackageRepository() { return packageRepository; } - /** - * Gets a logger for the specified class. - * - * @param klass 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); - } - /** * 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. @@ -781,7 +771,7 @@ public TruffleLogger getLogger(Class klass) { * @param clazz the class to name log entries with * @return a new logger for the specified {@code path} */ - public TruffleLogger getLoggerBoundToEngine(Class clazz) { + public TruffleLogger getLogger(Class clazz) { return environment.getLogger(clazz); } 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 ab1f57c451e9..d1643b14af59 100644 --- a/engine/runtime/src/test/java/org/enso/compiler/ExecCompilerTest.java +++ b/engine/runtime/src/test/java/org/enso/compiler/ExecCompilerTest.java @@ -33,7 +33,7 @@ public static void initEnsoContext() { RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(OutputStream.nullOutputStream()) + .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/SerializerTest.java b/engine/runtime/src/test/java/org/enso/compiler/SerializerTest.java index 85c0299f09e6..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,7 +5,6 @@ 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; @@ -30,7 +29,7 @@ public Context ensoContextForPackage(String name, File pkgFile) throws IOExcepti RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile().getAbsolutePath()) .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) - .logHandler(OutputStream.nullOutputStream()) + .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 ace0a945b64d..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,7 +2,6 @@ import static org.junit.Assert.assertTrue; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -31,7 +30,7 @@ public void prepareTest() throws IOException { Engine.newBuilder() .allowExperimentalOptions(true) .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) - .logHandler(new ByteArrayOutputStream()) + .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 ba6276ce7b0f..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,7 +2,6 @@ import static org.junit.Assert.assertTrue; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -31,7 +30,7 @@ public void prepareTest() throws IOException { Engine.newBuilder() .allowExperimentalOptions(true) .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) - .logHandler(new ByteArrayOutputStream()) + .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 37c175f2f605..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 @@ -61,7 +61,7 @@ public void initContext() { RuntimeOptions.LOG_LEVEL, 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 a19b09f36b04..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 @@ -19,14 +19,13 @@ public class SharedEngineTest extends TestBase { @BeforeClass public static void initializeSharedEngine() { - var out = new ByteArrayOutputStream(); sharedEngine = Engine.newBuilder() .allowExperimentalOptions(true) .option( RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(out) + .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 45b5d5d3c4bf..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,7 +9,6 @@ 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; @@ -46,7 +45,7 @@ protected static Context.Builder defaultContextBuilder(String... languages) { .allowIO(IOAccess.ALL) .allowAllAccess(true) .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) - .logHandler(new ByteArrayOutputStream()) + .logHandler(System.err) .option(RuntimeOptions.STRICT_ERRORS, "true") .option( RuntimeOptions.LANGUAGE_HOME_OVERRIDE, 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 e0814882a789..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 @@ -119,7 +119,7 @@ public boolean process(Set annotations, RoundEnvironment RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(new ByteArrayOutputStream()) + .logHandler(System.err) .option(RuntimeOptions.PROJECT_ROOT, projectRootDir.getAbsolutePath()) .option(RuntimeOptions.LANGUAGE_HOME_OVERRIDE, ensoHomeOverride.getAbsolutePath()) .build()) { @@ -249,7 +249,7 @@ private void generateClassForGroup( out.println(" .allowIO(IOAccess.ALL)"); out.println(" .allowAllAccess(true)"); out.println(" .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName())"); - out.println(" .logHandler(new ByteArrayOutputStream())"); + out.println(" .logHandler(System.err)"); out.println(" .option("); out.println(" RuntimeOptions.LANGUAGE_HOME_OVERRIDE,"); out.println(" languageHomeOverride.getAbsolutePath()"); From 6bb7a453075ad65a28b34ec2babb3e8910a5aea6 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 30 Oct 2023 18:17:33 +0100 Subject: [PATCH 4/5] nit --- .../enso/interpreter/runtime/TruffleCompilerContext.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From d7bc9dabd0eae9c2ff0b03ebcf8b9d8e27915f02 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 30 Oct 2023 22:58:08 +0100 Subject: [PATCH 5/5] nit --- .../bench/benchmarks/semantic/IfVsCaseBenchmarks.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 ce00dfbf7913..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 @@ -48,13 +48,14 @@ public class IfVsCaseBenchmarks extends TestBase { @Setup public void initializeBench(BenchmarkParams params) throws IOException { + OutputStream out = new ByteArrayOutputStream(); ctx = Context.newBuilder("enso") .allowAllAccess(true) .option( RuntimeOptions.LOG_LEVEL, Level.WARNING.getName() ) - .logHandler(out) + .logHandler(System.err) .out(out) .err(out) .allowIO(IOAccess.ALL)