diff options
author | Andrei Pozolotin <Andrei.Pozolotin@gmail.com> | 2014-12-03 10:27:17 -0600 |
---|---|---|
committer | Andrei Pozolotin <Andrei.Pozolotin@gmail.com> | 2014-12-04 08:02:56 -0600 |
commit | fe724251011c177aabdf2810dfb5d4eb3a97852c (patch) | |
tree | 2d9be3524a1b0df6c29c96a3e1b455f1147ab0ff /kamon-system-metrics/src/test/scala/kamon/metrics/RedirectLogging.scala | |
parent | 3905757c2eb9658d136c50de82180a74b002df7e (diff) | |
download | Kamon-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/scala/kamon/metrics/RedirectLogging.scala')
-rw-r--r-- | kamon-system-metrics/src/test/scala/kamon/metrics/RedirectLogging.scala | 34 |
1 files changed, 34 insertions, 0 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() + +} |