← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12808: Monitoring, logging

 

------------------------------------------------------------
revno: 12808
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-10-24 00:02:51 +0200
message:
  Monitoring, logging
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2013-10-23 22:03:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2013-10-23 22:02:51 +0000
@@ -233,31 +233,37 @@
     @Override
     public void scheduledRun()
     {
+        log.info( "Starting scheduled monitoring task" );
+        
         // Find all the rules belonging to groups that will send alerts to user roles.
 
         Set<ValidationRule> rules = getAlertRules();
 
         Collection<OrganisationUnit> sources = organisationUnitService.getAllOrganisationUnits();
+        
         Set<Period> periods = getAlertPeriodsFromRules( rules );
+        
         Date lastScheduledRun = (Date) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_LAST_MONITORING_RUN );
         
         // Any database changes after this moment will contribute to the next run.
         
         Date thisRun = new Date();
         
-        log.info( "Scheduled monitoring run sources[" + sources.size() + "] periods[" + periods.size() + "] rules[" + rules.size()
-            + "] last run " + lastScheduledRun == null ? "(none)" : lastScheduledRun );
+        log.info( "Scheduled monitoring run sources: " + sources.size() + ", periods: " + periods.size() + ", rules:" + rules.size()
+            + ", last run: " + ( lastScheduledRun == null ? "[none]" : lastScheduledRun ) );
         
         Collection<ValidationResult> results = Validator.validate( sources, periods, rules, ValidationRunType.SCHEDULED,
             lastScheduledRun, constantService, expressionService, periodService, dataValueService );
         
-        log.trace( "scheduledRun() results[" + results.size() + "]" );
+        log.info( "Run results: " + results.size() );
         
         if ( !results.isEmpty() )
         {
             postAlerts( results, thisRun );
         }
         
+        log.info( "Posted alerts, monitoring task done" );
+        
         systemSettingManager.saveSystemSetting( SystemSettingManager.KEY_LAST_MONITORING_RUN, thisRun );
     }