Merge pull request #132 from leonardehrenfried/disable-location

Disable ivy log4j caller location calculation
This commit is contained in:
Dale Wijnand 2017-11-09 08:46:27 +00:00 committed by GitHub
commit bf4f4a5d87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 7 deletions

View File

@ -2,8 +2,8 @@ language: scala
jdk: oraclejdk8
scala:
- 2.11.11
- 2.12.3
- 2.11.12
- 2.12.4
script:
- sbt -Dfile.encoding=UTF8 -J-XX:ReservedCodeCacheSize=256M "++$TRAVIS_SCALA_VERSION" mimaReportBinaryIssues scalafmt::test test:scalafmt::test test

View File

@ -31,7 +31,9 @@ sealed abstract class LogExchange {
false,
XLevel.DEBUG,
name,
"true",
// disable the calculation of caller location as it is very expensive
// https://issues.apache.org/jira/browse/LOG4J2-153
"false",
Array[AppenderRef](),
null,
config,

View File

@ -20,6 +20,18 @@ class ManagedLoggerSpec extends FlatSpec with Matchers {
log.infoEvent(1)
}
it should "validate performance improvement of disabling location calculation for async loggers" in {
val log = LogExchange.logger("foo")
LogExchange.bindLoggerAppenders("foo", List(LogExchange.asyncStdout -> Level.Info))
val before = System.currentTimeMillis()
1 to 10000 foreach { _ =>
log.debug("test")
}
val after = System.currentTimeMillis()
log.info(s"Peformance test took: ${after - before}ms")
}
it should "support logging Throwable out of the box" in {
import sbt.internal.util.codec.JsonProtocol._
val log = LogExchange.logger("foo")

View File

@ -4,10 +4,10 @@ import sbt.contraband.ContrabandPlugin.autoImport._
object Dependencies {
val scala210 = "2.10.6"
val scala211 = "2.11.11"
val scala212 = "2.12.3"
val scala211 = "2.11.12"
val scala212 = "2.12.4"
private val ioVersion = "1.0.0"
private val ioVersion = "1.0.2"
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion

View File

@ -1,4 +1,4 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.3")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.17")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.10")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.14")