From 0f6af9cef2846615f831ae309cf6b71953a3f1d3 Mon Sep 17 00:00:00 2001 From: eureka928 Date: Mon, 2 Mar 2026 09:19:37 +0100 Subject: [PATCH] [2.x] fix: Respect global log level in continuous build watcher **Problem** Running `sbt -error ~run` still prints [info] messages from the watcher ("Monitoring source files...", "Build triggered by...", etc). The watcher creates its logger using only the watchLogLevel setting (default Info), ignoring the global log level set via CLI flags like -error or -warn. **Solution** In Continuous.getCallbacks, take the more restrictive of the watchLogLevel and the global log level from State when configuring the watcher appender. Fixes #7355 --- main/src/main/scala/sbt/internal/Continuous.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/internal/Continuous.scala b/main/src/main/scala/sbt/internal/Continuous.scala index e9573a12a..8b1a018bf 100644 --- a/main/src/main/scala/sbt/internal/Continuous.scala +++ b/main/src/main/scala/sbt/internal/Continuous.scala @@ -271,7 +271,9 @@ private[sbt] object Continuous { validateCommands(s, commands) val configs = getAllConfigs(s, commands, dynamicInputs) val appender = ConsoleAppender(channel.name + "-watch", channel.terminal) - val level = configs.minBy(_.watchSettings.logLevel).watchSettings.logLevel + val watchLevel = configs.minBy(_.watchSettings.logLevel).watchSettings.logLevel + val globalLevel = s.get(Keys.logLevel.key).getOrElse(Level.Info) + val level = Seq(watchLevel, globalLevel).max context.addAppender(channel.name + "-watch", appender -> level) aggregate( configs,