← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2065: Changed some System.out to logging and cleaned up somewhat.

 

------------------------------------------------------------
revno: 2065
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-15 23:35:51 +0530
message:
  Changed some System.out to logging and cleaned up somewhat.
modified:
  local/in/dhis-in-services/dhis-in-service-configuration/src/main/java/org/hisp/dhis/config/DefaultConfigurationService.java
  local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportFormAction.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 'local/in/dhis-in-services/dhis-in-service-configuration/src/main/java/org/hisp/dhis/config/DefaultConfigurationService.java'
--- local/in/dhis-in-services/dhis-in-service-configuration/src/main/java/org/hisp/dhis/config/DefaultConfigurationService.java	2010-10-28 09:17:13 +0000
+++ local/in/dhis-in-services/dhis-in-service-configuration/src/main/java/org/hisp/dhis/config/DefaultConfigurationService.java	2010-11-15 18:05:51 +0000
@@ -10,12 +10,17 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.transaction.annotation.Transactional;
 
 @Transactional
 public class DefaultConfigurationService
     implements ConfigurationService
 {
+    private static final Log log = LogFactory.getLog( DefaultConfigurationService.class );
+
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -78,7 +83,7 @@
         }
         catch(Exception e)
         {
-            System.out.println(e.getMessage());
+            log.error(e);
             return false;
         }        
     }
@@ -105,7 +110,7 @@
 
         zipFilePath += "/mi.zip";
         
-        System.out.println("zipFilePath: "+ zipFilePath );
+        log.debug( "zipFilePath: "+ zipFilePath );
 
         ZipOutputStream out = null;
 
@@ -138,7 +143,7 @@
          }
          catch(Exception e)
          {
-           System.out.println( e.getMessage() );
+           log.error( e );
            
            return "INPUT";
          }
@@ -151,7 +156,7 @@
              }
              catch( Exception e )
              {
-                 System.out.println( e.getMessage() );
+                 log.error( "Exception trying to close output stream", e );
              }
          }
     }
@@ -184,7 +189,7 @@
         }
         catch(Exception e)
         {
-          System.out.println( e.getMessage() );
+          log.error( "Should handle these file stream better", e );
         } 
     }
 

=== modified file 'local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java'
--- local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java	2010-11-15 07:59:44 +0000
+++ local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java	2010-11-15 18:05:51 +0000
@@ -7,6 +7,7 @@
 import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -16,22 +17,26 @@
 
 import javax.swing.JOptionPane;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dbmanager.DataBaseManagerInterface;
 import org.hisp.dhis.linelisting.LineListDataValue;
 import org.hisp.dhis.linelisting.LineListElement;
 import org.hisp.dhis.linelisting.LineListService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.comparator.PeriodComparator;
 import org.hisp.dhis.source.Source;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
-import java.util.Collections;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
 public class MySQLDataBaseManager
     implements DataBaseManagerInterface
 {
+
+    private static final Log log = LogFactory.getLog( MySQLDataBaseManager.class );
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -156,7 +161,6 @@
             String columnDefinition = "select " + lineListElement.getShortName() + " from " + tableName;
             //ResultSet rs = statement.executeQuery( query );
             SqlRowSet rs = jdbcTemplate.queryForRowSet( columnDefinition );
-            System.out.println( "query = " + columnDefinition );
             if ( rs != null )
             {
                 int i = 0;
@@ -196,12 +200,11 @@
                     }
                 }
             }
-            System.out.println( "dataIsThere " + doNotDelete );
+            log.debug( tableName + ", " + lineListElement.getShortName() + (doNotDelete ? " has data" : " can be deleted") );
         } catch ( Exception e )
         {
-            e.printStackTrace();
+            log.error( "Caught exception while checking " + tableName + ", " + lineListElement.getShortName() + ". Won't delete.", e );
             doNotDelete = false;
-            System.out.println( "dataIsThere " + doNotDelete );
         }
 
         return doNotDelete;

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportFormAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportFormAction.java	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/ouwiseprogress/action/GenerateOuWiseProgressReportFormAction.java	2010-11-15 18:05:51 +0000
@@ -66,7 +66,7 @@
         
         periodTypeName = MonthlyPeriodType.NAME;
         
-        System.out.println( "PeriodTypeName: "+ periodTypeName);
+//        System.out.println( "PeriodTypeName: "+ periodTypeName);
         
 //        reportList = new ArrayList<Report_in>();