Better exception logging

Former-commit-id: 656f45de3ad89a53068e37d75b24297f7dbff446
This commit is contained in:
Ziver Koc 2016-01-29 09:25:21 +01:00
parent 2f934e6b43
commit 3e9d255532
3 changed files with 8 additions and 8 deletions

View file

@ -117,7 +117,7 @@ public class PCDataSynchronizationClient implements HalDaemon {
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.log(Level.SEVERE, null, e); logger.log(Level.SEVERE, "Thread has crashed", e);
} }
} }

View file

@ -36,8 +36,8 @@ public class SensorDataAggregatorDaemon implements HalDaemon {
aggregateSensor(sensor); aggregateSensor(sensor);
} }
logger.fine("Aggregation Done"); logger.fine("Aggregation Done");
} catch (SQLException e) { } catch (Exception e) {
logger.log(Level.SEVERE, null, e); logger.log(Level.SEVERE, "Thread has crashed", e);
} }
} }
@ -47,9 +47,9 @@ public class SensorDataAggregatorDaemon implements HalDaemon {
logger.fine("aggregating raw data to five minute periods"); logger.fine("aggregating raw data to five minute periods");
aggregateRawData(sensor, TimeUtility.FIVE_MINUTES_IN_MS, 5); aggregateRawData(sensor, TimeUtility.FIVE_MINUTES_IN_MS, 5);
logger.fine("aggregating five minute periods into hour periods"); logger.fine("aggregating five minute periods into hour periods");
aggrigateAggregatedData(sensor, TimeUtility.FIVE_MINUTES_IN_MS, TimeUtility.HOUR_IN_MS); aggregateAggregatedData(sensor, TimeUtility.FIVE_MINUTES_IN_MS, TimeUtility.HOUR_IN_MS);
logger.fine("aggregating one hour periods into one day periods"); logger.fine("aggregating one hour periods into one day periods");
aggrigateAggregatedData(sensor, TimeUtility.HOUR_IN_MS, TimeUtility.DAY_IN_MS); aggregateAggregatedData(sensor, TimeUtility.HOUR_IN_MS, TimeUtility.DAY_IN_MS);
//}else{ //}else{
// logger.fine("The sensor type("+ sensor.getSensorData().getClass().getName() +") is not supported by the aggregation daemon. Ignoring"); // logger.fine("The sensor type("+ sensor.getSensorData().getClass().getName() +") is not supported by the aggregation daemon. Ignoring");
//} //}
@ -97,7 +97,7 @@ public class SensorDataAggregatorDaemon implements HalDaemon {
* @param fromPeriodSizeInMs The period length in ms to aggregate from * @param fromPeriodSizeInMs The period length in ms to aggregate from
* @param toPeriodSizeInMs The period length in ms to aggregate to * @param toPeriodSizeInMs The period length in ms to aggregate to
*/ */
private void aggrigateAggregatedData(Sensor sensor, long fromPeriodSizeInMs, long toPeriodSizeInMs){ private void aggregateAggregatedData(Sensor sensor, long fromPeriodSizeInMs, long toPeriodSizeInMs){
long sensorId = sensor.getId(); long sensorId = sensor.getId();
AggregationMethod aggrMethod = sensor.getAggregationMethod(); AggregationMethod aggrMethod = sensor.getAggregationMethod();
int expectedSampleCount = (int)Math.ceil((double)toPeriodSizeInMs / (double)fromPeriodSizeInMs); int expectedSampleCount = (int)Math.ceil((double)toPeriodSizeInMs / (double)fromPeriodSizeInMs);

View file

@ -35,8 +35,8 @@ public class SensorDataCleanupDaemon implements HalDaemon {
cleanupSensor(sensor); cleanupSensor(sensor);
} }
logger.fine("Data cleanup done"); logger.fine("Data cleanup done");
} catch (SQLException e) { } catch (Exception e) {
e.printStackTrace(); logger.log(Level.SEVERE, "Thread has crashed", e);
} }
} }