Skip to content

Commit

Permalink
Merge pull request #956 from Kotlin/fastdoubleparser-test-logs
Browse files Browse the repository at this point in the history
Fix: disabled FastDoubleParser debug logs overload in the tests
  • Loading branch information
Jolanrensen authored Nov 21, 2024
2 parents c7b1004 + 2ffa761 commit 4cbd453
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ dependencies {
}
testImplementation(libs.kotlin.scriptingJvm)
testImplementation(libs.jsoup)
testImplementation(libs.sl4jsimple)
}

val samplesImplementation by configurations.getting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@ import org.junit.Test
import java.text.NumberFormat
import java.util.Locale

private const val LOG_LEVEL = "org.slf4j.simpleLogger.defaultLogLevel"

class FastDoubleParserTests {

private val logLevel = "org.slf4j.simpleLogger.log.${FastDoubleParser::class.qualifiedName}"
private var loggerBefore: String? = null

@Before
fun setLogger() {
loggerBefore = System.getProperty(LOG_LEVEL)
System.setProperty(LOG_LEVEL, "debug")
loggerBefore = System.getProperty(logLevel)
System.setProperty(logLevel, "debug")
}

@After
fun restoreLogger() {
if (loggerBefore != null) {
System.setProperty(LOG_LEVEL, loggerBefore)
System.setProperty(logLevel, loggerBefore)
}
}

Expand Down
38 changes: 38 additions & 0 deletions core/src/test/resources/simplelogger.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SLF4J's SimpleLogger configuration file
# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.

# Default logging detail level for all instances of SimpleLogger.
# Must be one of ("trace", "debug", "info", "warn", or "error").
# If not specified, defaults to "info".
org.slf4j.simpleLogger.defaultLogLevel=debug

# Logging detail level for a SimpleLogger instance named "xxxxx".
# Must be one of ("trace", "debug", "info", "warn", or "error").
# If not specified, the default logging detail level is used.
#org.slf4j.simpleLogger.log.xxxxx=

# Set to true if you want the current date and time to be included in output messages.
# Default is false, and will output the number of milliseconds elapsed since startup.
org.slf4j.simpleLogger.showDateTime=true

# The date and time format to be used in the output messages.
# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat.
# If the format is not specified or is invalid, the default format is used.
# The default format is yyyy-MM-dd HH:mm:ss:SSS Z.
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z

# Set to true if you want to output the current thread name.
# Defaults to true.
org.slf4j.simpleLogger.showThreadName=true

# Set to true if you want the Logger instance name to be included in output messages.
# Defaults to true.
org.slf4j.simpleLogger.showLogName=true

# Set to true if you want the last component of the name to be included in output messages.
# Defaults to false.
#org.slf4j.simpleLogger.showShortLogName=false

# Disables FastDoubleParser debug logs by default in our tests
# Can be enabled by setting the system property programmatically
org.slf4j.simpleLogger.log.org.jetbrains.kotlinx.dataframe.impl.io.FastDoubleParser=warn

0 comments on commit 4cbd453

Please sign in to comment.