Loggin improvement in the PRi sensor

Former-commit-id: 190bc7c849549b13f1abc8058bbae726883d65d6
This commit is contained in:
Daniel Collin 2016-01-15 10:52:35 +01:00
parent bd14a79be7
commit 656bc41226

View file

@ -4,6 +4,7 @@ import com.pi4j.io.gpio.*;
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent; import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
import com.pi4j.io.gpio.event.GpioPinListenerDigital; import com.pi4j.io.gpio.event.GpioPinListenerDigital;
import zutil.db.DBConnection; import zutil.db.DBConnection;
import zutil.log.CompactLogFormatter;
import zutil.log.LogUtil; import zutil.log.LogUtil;
import java.sql.SQLException; import java.sql.SQLException;
@ -33,6 +34,14 @@ public class RPiImpulseCountSensor implements Runnable {
*/ */
public RPiImpulseCountSensor(int sensorId, Pin pin) throws Exception{ 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; this.sensorId = sensorId;
// create gpio controller // create gpio controller