aboutsummaryrefslogtreecommitdiff
path: root/kamon-system-metrics/src/test
diff options
context:
space:
mode:
authorAndrei Pozolotin <Andrei.Pozolotin@gmail.com>2014-12-03 10:27:17 -0600
committerAndrei Pozolotin <Andrei.Pozolotin@gmail.com>2014-12-04 08:02:56 -0600
commitfe724251011c177aabdf2810dfb5d4eb3a97852c (patch)
tree2d9be3524a1b0df6c29c96a3e1b455f1147ab0ff /kamon-system-metrics/src/test
parent3905757c2eb9658d136c50de82180a74b002df7e (diff)
downloadKamon-fe724251011c177aabdf2810dfb5d4eb3a97852c.tar.gz
Kamon-fe724251011c177aabdf2810dfb5d4eb3a97852c.tar.bz2
Kamon-fe724251011c177aabdf2810dfb5d4eb3a97852c.zip
+ system-metrics: two-phase sigar loading
* update slf4jVersion * redirect JUL and LOG4J logging to SLF4J * use two-phase sigar loading
Diffstat (limited to 'kamon-system-metrics/src/test')
-rw-r--r--kamon-system-metrics/src/test/scala/kamon/metrics/RedirectLogging.scala34
-rw-r--r--kamon-system-metrics/src/test/scala/kamon/metrics/SystemMetricsSpec.scala2
2 files changed, 35 insertions, 1 deletions
diff --git a/kamon-system-metrics/src/test/scala/kamon/metrics/RedirectLogging.scala b/kamon-system-metrics/src/test/scala/kamon/metrics/RedirectLogging.scala
new file mode 100644
index 00000000..fbf42cf0
--- /dev/null
+++ b/kamon-system-metrics/src/test/scala/kamon/metrics/RedirectLogging.scala
@@ -0,0 +1,34 @@
+/* =========================================================================================
+ * Copyright © 2013-2014 the kamon project <http://kamon.io/>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ * =========================================================================================
+ */
+
+package kamon.metric
+
+import java.util.logging.LogManager
+import org.slf4j.bridge.SLF4JBridgeHandler
+
+/**
+ * Redirect different logging sources to SLF4J.
+ */
+trait RedirectLogging {
+
+ def redirectLogging(): Unit = {
+ // Redirect JUL to SLF4J.
+ LogManager.getLogManager().reset();
+ SLF4JBridgeHandler.install();
+ }
+
+ redirectLogging()
+
+}
diff --git a/kamon-system-metrics/src/test/scala/kamon/metrics/SystemMetricsSpec.scala b/kamon-system-metrics/src/test/scala/kamon/metrics/SystemMetricsSpec.scala
index 058dafb4..714a1e6d 100644
--- a/kamon-system-metrics/src/test/scala/kamon/metrics/SystemMetricsSpec.scala
+++ b/kamon-system-metrics/src/test/scala/kamon/metrics/SystemMetricsSpec.scala
@@ -33,7 +33,7 @@ import org.scalatest.{ Matchers, WordSpecLike }
import scala.concurrent.duration._
-class SystemMetricsSpec extends TestKitBase with WordSpecLike with Matchers {
+class SystemMetricsSpec extends TestKitBase with WordSpecLike with Matchers with RedirectLogging {
implicit lazy val system: ActorSystem = ActorSystem("system-metrics-spec", ConfigFactory.parseString(
"""
|akka {