From 656bc41226bb2482460a398a24ed5a123504fdef Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Fri, 15 Jan 2016 10:52:35 +0100 Subject: [PATCH] Loggin improvement in the PRi sensor Former-commit-id: 190bc7c849549b13f1abc8058bbae726883d65d6 --- src/se/hal/plugin/localsensor/RPiImpulseCountSensor.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/se/hal/plugin/localsensor/RPiImpulseCountSensor.java b/src/se/hal/plugin/localsensor/RPiImpulseCountSensor.java index 73e6bff5..91f81563 100755 --- a/src/se/hal/plugin/localsensor/RPiImpulseCountSensor.java +++ b/src/se/hal/plugin/localsensor/RPiImpulseCountSensor.java @@ -4,6 +4,7 @@ import com.pi4j.io.gpio.*; import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent; import com.pi4j.io.gpio.event.GpioPinListenerDigital; import zutil.db.DBConnection; +import zutil.log.CompactLogFormatter; import zutil.log.LogUtil; import java.sql.SQLException; @@ -33,6 +34,14 @@ public class RPiImpulseCountSensor implements Runnable { */ public RPiImpulseCountSensor(int sensorId, Pin pin) throws Exception{ + // init logging + CompactLogFormatter formatter = new CompactLogFormatter(); + LogUtil.setLevel("se.hal", Level.FINEST); + LogUtil.setFormatter("se.hal", formatter); + LogUtil.setLevel("zutil", Level.FINEST); + LogUtil.setFormatter("zutil", formatter); + LogUtil.setGlobalFormatter(formatter); + this.sensorId = sensorId; // create gpio controller