[2.x] deprecate useLog4J SettingKey (#8523)

This commit is contained in:
kenji yoshida 2026-01-14 08:46:41 +09:00 committed by GitHub
parent 727f4b05c6
commit eb81ff9000
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 6 deletions

View File

@ -337,7 +337,6 @@ object Defaults extends BuildCommon {
new AppenderSupplier:
def apply(s: ScopedKey[?]): Seq[Appender] = Nil
},
useLog4J :== false,
watchSources :== Nil, // Although this is deprecated, it can't be removed or it breaks += for legacy builds.
skip :== false,
taskTemporaryDirectory := {

View File

@ -62,6 +62,7 @@ object Keys {
val timingFormat = settingKey[java.text.DateFormat]("The format used for displaying the completion time.").withRank(CSetting)
@transient
val extraAppenders = settingKey[AppenderSupplier]("A function that provides additional loggers for a given setting.").withRank(DSetting)
@deprecated("will be removed", "2.0.0")
val useLog4J = settingKey[Boolean]("Toggles whether or not to use log4j for sbt internal loggers.").withRank(Invisible)
val logManager = settingKey[LogManager]("The log manager, which creates Loggers for different contexts.").withRank(DSetting)
private[sbt] val loggerContext = AttributeKey[LoggerContext]("sbt-logger-context", "The logger config which creates Loggers for different contexts.", Int.MaxValue)

View File

@ -980,10 +980,9 @@ object BuiltinCommands {
s2,
st => setupGlobalFileTreeRepository(Clean.addCacheStoreFactoryFactory(st))
)
val s4 = s3.put(Keys.useLog4J.key, Project.extract(s3).get(Keys.useLog4J))
addSuperShellParams(
CheckBuildSources.init(
LintUnused.lintScalaVersion(LintUnused.lintUnusedFunc(s4))
LintUnused.lintScalaVersion(LintUnused.lintUnusedFunc(s3))
)
)
}

View File

@ -84,6 +84,7 @@ private[sbt] abstract class AbstractBackgroundJobService extends BackgroundJobSe
ExecutionContext.fromExecutor(pool.executor)
private[sbt] def serviceTempDirBase: File
@deprecated("will be removed", "2.0.0")
private[sbt] def useLog4J: Boolean
private val serviceTempDirRef = new AtomicReference[File]
private def serviceTempDir: File = serviceTempDirRef.synchronized {
@ -542,6 +543,8 @@ private[sbt] class DefaultBackgroundJobService(
private[sbt] val serviceTempDirBase: File,
override private[sbt] val useLog4J: Boolean
) extends AbstractBackgroundJobService {
def this(serviceTempDirBase: File) = this(serviceTempDirBase, false)
@deprecated("Use the constructor that specifies the background job temporary directory", "1.4.0")
def this() = this(IO.createTemporaryDirectory, false)
}
@ -564,8 +567,7 @@ private[sbt] object DefaultBackgroundJobService {
private[sbt] lazy val backgroundJobServiceSetting: Setting[?] =
(GlobalScope / Keys.bgJobService) := {
val path = (GlobalScope / sbt.Keys.bgJobServiceDirectory).value
val useLog4J = (GlobalScope / Keys.useLog4J).value
val newService = new DefaultBackgroundJobService(path, useLog4J)
val newService = new DefaultBackgroundJobService(path)
backgroundJobServices.putIfAbsent(path, newService) match {
case null => newService
case s =>

View File

@ -153,7 +153,8 @@ object SysProp {
def banner: Boolean = getOrTrue("sbt.banner")
def useLog4J: Boolean = getOrFalse("sbt.log.uselog4j")
@deprecated("will be removed", "2.0.0")
def useLog4J: Boolean = false
def turbo: Boolean = getOrFalse("sbt.turbo")
def pipelining: Boolean = getOrFalse("sbt.pipelining")