Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Replace a custom logger with off the shelf implementation #7559

Merged
merged 32 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3291d33
Replace a custom logger with sth off the shelf
hubertp Jul 27, 2023
0bf5abc
format sbt
hubertp Aug 10, 2023
1591ff6
Fix native image build, many tests
hubertp Aug 14, 2023
0d55893
update changelog
hubertp Aug 14, 2023
51b87b3
minor formatting
hubertp Aug 14, 2023
407476f
fix test
hubertp Aug 14, 2023
d597380
Bring back jul's formatting to runtime
hubertp Aug 14, 2023
7b0afd4
Fix some tests
hubertp Aug 15, 2023
372af9e
Use test logger when collecting logs of a specific test
hubertp Aug 15, 2023
f03d263
Bandaid to make sure launcher's logging works
hubertp Aug 15, 2023
80f0f12
Significantly simplifying logger's setup
hubertp Aug 20, 2023
57ff421
More simplifications, documentation
hubertp Aug 21, 2023
bece946
Functionality-wise - done.
hubertp Aug 22, 2023
d0a784e
logging-service - bye!
hubertp Aug 22, 2023
3faffe3
Ensure logging impl is not accidentally used
hubertp Aug 23, 2023
d3d3e04
Separate logger implementation from setup api
hubertp Aug 24, 2023
e87b8a8
Scala -> Java
hubertp Aug 25, 2023
b142d40
Minor simplifications
hubertp Aug 25, 2023
5c8ae56
update documentation
hubertp Aug 25, 2023
25ee772
Tweaks to native image config
hubertp Aug 25, 2023
5d851ed
post-rebase tweaks
hubertp Aug 25, 2023
9e22fd9
fmt
hubertp Aug 25, 2023
d328f6b
User ServiceLoader to load implementation
hubertp Aug 27, 2023
d97d39c
nits
hubertp Aug 27, 2023
d274e98
Address PR comments
hubertp Sep 1, 2023
599eeab
linter
hubertp Sep 1, 2023
4845350
Apply suggestions from code review
hubertp Sep 1, 2023
69ca666
Addressing more PR comments
hubertp Sep 1, 2023
a02d5ad
Merge branch 'develop' into wip/hubert/7253-replace-custom-logger
hubertp Sep 1, 2023
3ccf22d
Some Sentry additions, tested with prod
hubertp Sep 3, 2023
ea4a68c
Fix native image build
hubertp Sep 3, 2023
ffb40f2
formatting
hubertp Sep 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@
- [Using official BigInteger support][7420]
- [Allow users to give a project other than Upper_Snake_Case name][7397]
- [Support renaming variable or function][7515]
- [Replace custom logging service with off the shelf library][7559]
- [Only use types as State keys][7585]
- [Allow Java Enums in case of branches][7607]
- [Notification about the project rename action][7613]
Expand Down Expand Up @@ -1054,6 +1055,7 @@
[7420]: https://github.com/enso-org/enso/pull/7420
[7397]: https://github.com/enso-org/enso/pull/7397
[7515]: https://github.com/enso-org/enso/pull/7515
[7559]: https://github.com/enso-org/enso/pull/7559
[7585]: https://github.com/enso-org/enso/pull/7585
[7607]: https://github.com/enso-org/enso/pull/7607
[7613]: https://github.com/enso-org/enso/pull/7613
Expand Down
164 changes: 105 additions & 59 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,12 @@ lazy val enso = (project in file("."))
`task-progress-notifications`,
`profiling-utils`,
`logging-utils`,
filewatcher,
`logging-jutil`,
`logging-config`,
`logging-logback`,
`logging-service`,
`logging-utils-akka`,
filewatcher,
`logging-truffle-connector`,
`locking-test-helper`,
`akka-native`,
Expand Down Expand Up @@ -338,24 +342,26 @@ lazy val enso = (project in file("."))

// === Akka ===================================================================

def akkaPkg(name: String) = akkaURL %% s"akka-$name" % akkaVersion
def akkaHTTPPkg(name: String) = akkaURL %% s"akka-$name" % akkaHTTPVersion
def akkaPkg(name: String) = akkaURL %% s"akka-$name" % akkaVersion
def akkaHTTPPkg(name: String) = akkaURL %% s"akka-$name" % akkaHTTPVersion
val akkaURL = "com.typesafe.akka"
val akkaVersion = "2.6.20"
val akkaHTTPVersion = "10.2.10"
val akkaMockSchedulerVersion = "0.5.5"
val logbackClassicVersion = "1.3.7"
val akkaActor = akkaPkg("actor")
val akkaStream = akkaPkg("stream")
val akkaTyped = akkaPkg("actor-typed")
val akkaTestkit = akkaPkg("testkit")
val akkaSLF4J = akkaPkg("slf4j")
val akkaTestkitTyped = akkaPkg("actor-testkit-typed") % Test
val akkaHttp = akkaHTTPPkg("http")
val akkaSpray = akkaHTTPPkg("http-spray-json")
val akkaTest = Seq(
"ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test
val logbackPkg = Seq(
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"ch.qos.logback" % "logback-core" % logbackClassicVersion
)
val akkaActor = akkaPkg("actor")
val akkaStream = akkaPkg("stream")
val akkaTyped = akkaPkg("actor-typed")
val akkaTestkit = akkaPkg("testkit")
val akkaSLF4J = akkaPkg("slf4j")
val akkaTestkitTyped = akkaPkg("actor-testkit-typed") % Test
val akkaHttp = akkaHTTPPkg("http")
val akkaSpray = akkaHTTPPkg("http-spray-json")
val akkaTest = logbackPkg.map(_ % Test)
hubertp marked this conversation as resolved.
Show resolved Hide resolved
val akka =
Seq(
akkaActor,
Expand Down Expand Up @@ -679,8 +685,8 @@ lazy val `logging-utils` = project
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
"org.scalatest" %% "scalatest" % scalatestVersion % Test
) ++ logbackPkg.map(_ % Test)
hubertp marked this conversation as resolved.
Show resolved Hide resolved
)

lazy val `logging-service` = project
Expand All @@ -690,27 +696,64 @@ lazy val `logging-service` = project
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe" % "config" % typesafeConfigVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
akkaStream,
akkaHttp,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.graalvm.nativeimage" % "svm" % graalMavenPackagesVersion % "provided"
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe" % "config" % typesafeConfigVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
akkaHttp
)
)
.dependsOn(`logging-utils`)
.dependsOn(`logging-config`)

lazy val `logging-jutil` = project
.in(file("lib/scala/logging-jutil"))
.configs(Test)
.settings(
if (Platform.isWindows)
(Compile / unmanagedSourceDirectories) += (Compile / sourceDirectory).value / "java-windows"
else
(Compile / unmanagedSourceDirectories) += (Compile / sourceDirectory).value / "java-unix"
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion
)
)

lazy val `logging-config` = project
.in(file("lib/scala/logging-config"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"com.typesafe" % "config" % typesafeConfigVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion
)
)

lazy val `logging-logback` = project
.in(file("lib/scala/logging-logback"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"io.sentry" % "sentry-logback" % "6.28.0" % Provided,
hubertp marked this conversation as resolved.
Show resolved Hide resolved
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
hubertp marked this conversation as resolved.
Show resolved Hide resolved
) ++ logbackPkg
)
.dependsOn(`logging-config`)
.dependsOn(`logging-service`)

lazy val `logging-utils-akka` = project
.in(file("lib/scala/logging-utils-akka"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion
)
)
.dependsOn(`akka-native`)
.dependsOn(`logging-utils`)

lazy val filewatcher = project
.in(file("lib/scala/filewatcher"))
Expand All @@ -719,10 +762,10 @@ lazy val filewatcher = project
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"io.methvin" % "directory-watcher" % directoryWatcherVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
"io.methvin" % "directory-watcher" % directoryWatcherVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
) ++ logbackPkg.map(_ % Test)
hubertp marked this conversation as resolved.
Show resolved Hide resolved
)
.dependsOn(testkit % Test)

Expand Down Expand Up @@ -880,8 +923,11 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager"))
.dependsOn(`polyglot-api`)
.dependsOn(`runtime-version-manager`)
.dependsOn(`library-manager`)
.dependsOn(`logging-utils-akka`)
hubertp marked this conversation as resolved.
Show resolved Hide resolved
.dependsOn(`logging-service`)
.dependsOn(pkg)
.dependsOn(`json-rpc-server`)
.dependsOn(`logging-logback` % Runtime)
hubertp marked this conversation as resolved.
Show resolved Hide resolved
.dependsOn(`json-rpc-server-test` % Test)
.dependsOn(testkit % Test)
.dependsOn(`runtime-version-manager-test` % Test)
Expand Down Expand Up @@ -953,11 +999,10 @@ lazy val searcher = project
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= jmh ++ Seq(
"com.typesafe.slick" %% "slick" % slickVersion,
"org.xerial" % "sqlite-jdbc" % sqliteVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
"com.typesafe.slick" %% "slick" % slickVersion,
"org.xerial" % "sqlite-jdbc" % sqliteVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
) ++ logbackPkg.map(_ % Test)
hubertp marked this conversation as resolved.
Show resolved Hide resolved
)
.configs(Benchmark)
.settings(
Expand Down Expand Up @@ -1081,6 +1126,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
commands += WithDebugCommand.withDebug,
frgaalJavaCompilerSetting,
libraryDependencies ++= akka ++ circe ++ Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion,
"io.circe" %% "circe-literal" % circeVersion,
Expand Down Expand Up @@ -1117,7 +1163,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
Test / javaOptions ++= {
// Note [Classpath Separation]
val runtimeClasspath =
(LocalProject("runtime") / Compile / fullClasspath).value
(LocalProject("runtime") / Runtime / fullClasspath).value
.map(_.data)
.mkString(File.pathSeparator)
Seq(
Expand All @@ -1138,7 +1184,9 @@ lazy val `language-server` = (project in file("engine/language-server"))
.dependsOn(`library-manager`)
.dependsOn(`connected-lock-manager`)
.dependsOn(`edition-updater`)
.dependsOn(`logging-utils-akka`)
.dependsOn(`logging-service`)
.dependsOn(`logging-jutil`)
.dependsOn(`polyglot-api`)
.dependsOn(`searcher`)
.dependsOn(`text-buffer`)
Expand All @@ -1147,6 +1195,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
.dependsOn(`profiling-utils`)
.dependsOn(filewatcher)
.dependsOn(testkit % Test)
.dependsOn(`logging-logback` % Test)
.dependsOn(`library-manager-test` % Test)
.dependsOn(`runtime-version-manager-test` % Test)

Expand Down Expand Up @@ -1409,12 +1458,10 @@ lazy val runtime = (project in file("engine/runtime"))
.dependsOn(`interpreter-dsl`)
.dependsOn(`library-manager`)
.dependsOn(`logging-truffle-connector`)
.dependsOn(`logging-utils`)
.dependsOn(`polyglot-api`)
.dependsOn(`text-buffer`)
.dependsOn(`runtime-parser`)
.dependsOn(pkg)
.dependsOn(`edition-updater`)
.dependsOn(`connected-lock-manager`)
.dependsOn(testkit % Test)

Expand Down Expand Up @@ -1640,8 +1687,8 @@ lazy val `engine-runner` = project
commands += WithDebugCommand.withDebug,
inConfig(Compile)(truffleRunOptionsSettings),
libraryDependencies ++= Seq(
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % Provided,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % Provided,
"commons-cli" % "commons-cli" % commonsCliVersion,
"com.monovore" %% "decline" % declineVersion,
"org.jline" % "jline" % jlineVersion,
Expand Down Expand Up @@ -1670,12 +1717,9 @@ lazy val `engine-runner` = project
mainClass = Option("org.enso.runner.Main"),
cp = Option("runtime.jar"),
initializeAtRuntime = Seq(
// Note [WSLoggerManager Shutdown Hook]
"org.enso.loggingservice.WSLoggerManager$",
"org.jline.nativ.JLineLibrary",
"io.methvin.watchservice.jna.CarbonAPI",
"org.enso.syntax2.Parser",
"org.enso.loggingservice",
"zio.internal.ZScheduler$$anon$4",
"sun.awt",
"sun.java2d",
Expand All @@ -1700,8 +1744,11 @@ lazy val `engine-runner` = project
.dependsOn(cli)
.dependsOn(`library-manager`)
.dependsOn(`language-server`)
.dependsOn(`polyglot-api`)
.dependsOn(`logging-jutil`)
.dependsOn(`edition-updater`)
.dependsOn(`logging-service`)
.dependsOn(`logging-logback` % Runtime)
.dependsOn(`polyglot-api`)

lazy val launcher = project
.in(file("engine/launcher"))
Expand All @@ -1725,10 +1772,6 @@ lazy val launcher = project
additionalOptions = Seq(
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$"
),
initializeAtRuntime = Seq(
// Note [WSLoggerManager Shutdown Hook]
"org.enso.loggingservice.WSLoggerManager$"
)
)
.dependsOn(installNativeImage)
Expand Down Expand Up @@ -1761,13 +1804,19 @@ lazy val launcher = project
.dependsOn(buildNativeImage)
.dependsOn(LauncherShimsForTest.prepare())
.value,
Test / parallelExecution := false
(Test / testOnly) := (Test / testOnly)
.dependsOn(buildNativeImage)
.dependsOn(LauncherShimsForTest.prepare())
.evaluated
)
.dependsOn(cli)
.dependsOn(`runtime-version-manager`)
.dependsOn(`version-output`)
.dependsOn(pkg)
.dependsOn(`logging-utils` % "test->test")
.dependsOn(`logging-service`)
.dependsOn(`logging-logback` % Test)
.dependsOn(`logging-logback` % Runtime)
.dependsOn(`distribution-manager` % Test)
.dependsOn(`runtime-version-manager-test` % Test)

Expand Down Expand Up @@ -1996,7 +2045,6 @@ lazy val `library-manager` = project
.dependsOn(`distribution-manager`)
.dependsOn(downloader)
.dependsOn(testkit % Test)
.dependsOn(`logging-service` % Test)

lazy val `library-manager-test` = project
.in(file("lib/scala/library-manager-test"))
Expand All @@ -2010,8 +2058,8 @@ lazy val `library-manager-test` = project
)
)
.dependsOn(`library-manager`)
.dependsOn(`logging-utils` % "test->test")
.dependsOn(testkit)
.dependsOn(`logging-service`)

lazy val `connected-lock-manager` = project
.in(file("lib/scala/connected-lock-manager"))
Expand Down Expand Up @@ -2046,7 +2094,6 @@ lazy val `runtime-version-manager` = project
)
.dependsOn(pkg)
.dependsOn(downloader)
.dependsOn(`logging-service`)
.dependsOn(cli)
.dependsOn(`version-output`)
.dependsOn(`edition-updater`)
Expand All @@ -2070,7 +2117,6 @@ lazy val `runtime-version-manager-test` = project
.value
)
.dependsOn(`runtime-version-manager`)
.dependsOn(`logging-service`)
.dependsOn(testkit)
.dependsOn(cli)
.dependsOn(`distribution-manager`)
Expand Down
Loading