Add proper error logging.
A => Queries/Skills.sql +5 -0
@@ 0,0 1,5 @@ 
+
+Select ID, Company_Name, Design_Engine as Engine, Design_Chassis as Chassis, Design_Transmission as Transmission, 
+Design_Body as Body, Design_Lux as Lux, Design_Safety as Safety,
+(Design_Engine + Design_Chassis + Design_Transmission + Design_Body + Design_Lux + Design_Safety) / 6.0 as Average
+From CompanyList
  No newline at end of file

          
M Queries/StockOwnership.sql +3 -2
@@ 1,4 1,5 @@ 
-select Company_Name, Stocks_Selfowned, Stocks_Issued,  COALESCE((Stocks_Selfowned * 100/Stocks_Issued), 100) as Self_Ownership
+select Company_Name, Stocks_Avaliable, Coalesce((Stocks_Avaliable * 100.0)/Stocks_Issued, 0) as AvailablePercentage, Stocks_Selfowned, Stocks_Issued,  COALESCE((Stocks_Selfowned * 100/Stocks_Issued), 100) as Self_Ownership
 from CompanyList
 where Active = 1
-order by Self_Ownership DESC
  No newline at end of file
+order by AvailablePercentage Desc
+--order by Self_Ownership DESC
  No newline at end of file

          
M pom.xml +5 -0
@@ 16,5 16,10 @@ 
             <artifactId>sqlite-jdbc</artifactId>
             <version>3.36.0</version>
         </dependency>
+	<dependency>
+		<groupId>log4j</groupId>
+		<artifactId>log4j</artifactId>
+		<version>1.2.17</version>
+	</dependency>
     </dependencies>
 </project>
  No newline at end of file

          
M src/main/java/com/ajtjp/gearcitydata/BranchSummaryResult.java +4 -1
@@ 7,6 7,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.log4j.*;
 
 /**
  *

          
@@ 16,6 17,8 @@ public class BranchSummaryResult {
     private final String companyName;
     private final int branches;
     private final long branchValue;
+    
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.BranchSummaryResult");
 
     private BranchSummaryResult(String companyName, int branches, long branchValue) {
         this.companyName = companyName;

          
@@ 54,7 57,7 @@ public class BranchSummaryResult {
             return branchList;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Branch summary SQL error", ex);
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/DefunctCompanyResult.java +4 -2
@@ 1,12 1,12 @@ 
 
 package com.ajtjp.gearcitydata;
 
-import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.log4j.Logger;
 
 /**
  *

          
@@ 18,6 18,8 @@ public class DefunctCompanyResult {
     private int founded;
     private int defunct;
     private String parent;
+    
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.DefunctCompanyResult");
 
     public DefunctCompanyResult(String companyName, String fate, int founded, int defunct, String parent) {
         this.companyName = companyName;

          
@@ 98,7 100,7 @@ public class DefunctCompanyResult {
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("DefunctCompanyResult SQL error", ex);
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/FactorySummaryResult.java +4 -1
@@ 7,6 7,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.log4j.Logger;
 
 /**
  *

          
@@ 17,6 18,8 @@ public class FactorySummaryResult {
     private final int factories;
     private final int factoryLines;
     private final long factoryValue;
+    
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.BranchSummaryResult");
 
     private FactorySummaryResult(String companyName, int factories, int factoryLines, long factoryValue) {
         this.companyName = companyName;

          
@@ 58,7 61,7 @@ public class FactorySummaryResult {
             return fsList;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("FactorySummaryResult SQL error", ex);
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/SaveFile.java +12 -9
@@ 14,6 14,7 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.stream.Collectors;
+import org.apache.log4j.Logger;
 
 /**
  *

          
@@ 28,6 29,8 @@ public class SaveFile {
     private List<Company> playerCompanies = new ArrayList<>();
     private boolean secondGear = false;
     
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.SaveFile");
+    
     public SaveFile(String fileName) throws SQLException {
         try {
             // db parameters

          
@@ 42,7 45,7 @@ public class SaveFile {
             getPlayerCompanyInfo();
             getSecondGear();
         } catch (SQLException e) {
-            System.out.println(e.getMessage());
+            logger.error("Save file initialization SQL exception", e);
             throw e;
         } finally {
         }

          
@@ 59,7 62,7 @@ public class SaveFile {
             }
         }
         catch(SQLException ex) {
-            System.out.println(ex);
+            logger.error("Save file exception - get game year", ex);
         }
     }
     

          
@@ 74,7 77,7 @@ public class SaveFile {
             }
         }
         catch(SQLException ex) {
-            System.out.println(ex);
+            logger.error("Save file exception - get game turn", ex);
         }
     }
     

          
@@ 92,7 95,7 @@ public class SaveFile {
             }
         }
         catch(SQLException ex) {
-            System.out.println(ex);
+            logger.error("Save file exception - get FBS (2nd Gear)", ex);
         }
     }
     

          
@@ 107,7 110,7 @@ public class SaveFile {
             }
         }
         catch(SQLException ex) {
-            System.out.println(ex);
+            logger.error("Save file exception - get player company info", ex);
         }
     }
     

          
@@ 159,7 162,7 @@ public class SaveFile {
             return sortedList;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Save file exception - get annual profitability for all companies", ex);
         }
         return new ArrayList<>();
     }

          
@@ 189,7 192,7 @@ public class SaveFile {
             return sortedList;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Save file exception - get annual profitability for company", ex);
         }
         return new ArrayList<>();
     }

          
@@ 219,7 222,7 @@ public class SaveFile {
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Save file exception - get Market Cap and P/B", ex);
         }
         return new ArrayList<>();
     }

          
@@ 248,7 251,7 @@ public class SaveFile {
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Save file exception - get annual market sales", ex);
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/SecretaryDB.java +4 -1
@@ 6,6 6,7 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.sql.Statement;
+import org.apache.log4j.Logger;
 
 /**
  * Represents the Secretary's database.

          
@@ 15,6 16,8 @@ import java.sql.Statement;
  */
 public class SecretaryDB {
     
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.SecretaryDB");
+    
     public Connection conn;
     
     public SecretaryDB(String fileName) {

          
@@ 55,7 58,7 @@ public class SecretaryDB {
             }
         }
         catch(SQLException ex) {
-            System.out.println("SQLException: " + ex.getMessage());
+            logger.error("Error connecting with secretary DB", ex);
         }
     }
 }

          
M src/main/java/com/ajtjp/gearcitydata/StockMarketResult.java +5 -1
@@ 7,12 7,16 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.log4j.Logger;
 
 /**
  *
  * @author Andrew
  */
 public class StockMarketResult {
+    
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.StockMarketResult");
+    
     private String companyName;
     private long sharesAvailable;
     private float percentAvailable;

          
@@ 52,7 56,7 @@ public class StockMarketResult {
             return stockList;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error getting stock market results", ex);
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/VehicleConfigurationResult.java +8 -5
@@ 15,6 15,7 @@ import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import org.apache.log4j.Logger;
 
 /**
  *

          
@@ 22,6 23,8 @@ import java.util.List;
  */
 public class VehicleConfigurationResult {
     
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.VehicleConfigurationResult");
+    
     public enum ResultType {
         LAYOUT,
         CYLINDERS,

          
@@ 97,7 100,7 @@ public class VehicleConfigurationResult 
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error getting average fuel economy", ex);
         }
         return new ArrayList<>();
     }

          
@@ 131,7 134,7 @@ public class VehicleConfigurationResult 
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error getting average horsepower", ex);
         }
         return new ArrayList<>();
     }

          
@@ 165,7 168,7 @@ public class VehicleConfigurationResult 
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error getting average torque", ex);
         }
         return new ArrayList<>();
     }

          
@@ 209,7 212,7 @@ public class VehicleConfigurationResult 
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error getting marque sales by year/country", ex);
         }
         return new ArrayList<>();
     }

          
@@ 234,7 237,7 @@ public class VehicleConfigurationResult 
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error getting countries sold in this year", ex);;
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/dataFetcher/MarketTrendsDataFetcher.java +4 -1
@@ 8,12 8,15 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.log4j.Logger;
 
 /**
  *
  * @author Andrew
  */
 public class MarketTrendsDataFetcher {
+    
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.MarketTrendsDataFetcher");
 
     public List<VehicleConfigurationResult> getFuelTypeDetails(String brand) {
         List<VehicleConfigurationResult> results = new ArrayList<>();

          
@@ 35,7 38,7 @@ public class MarketTrendsDataFetcher {
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with market trends data fetcher", ex);
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/dataFetcher/secondGear/MarketTrendsDataFetcherSecondGear.java +21 -18
@@ 10,12 10,15 @@ import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import org.apache.log4j.Logger;
 
 /**
  *
  * @author Andrew
  */
 public class MarketTrendsDataFetcherSecondGear extends MarketTrendsDataFetcher {
+    
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.MarketTrendsDataFetcherSecondGear");
 
     public List<VehicleConfigurationResult> getFuelTypeDetails(String brand, int gameGear) {
         List<VehicleConfigurationResult> results = new ArrayList<>();

          
@@ 44,7 47,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getFuelTypeDetails", ex);
         }
         return new ArrayList<>();
     }

          
@@ 80,7 83,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getLayoutSummary", ex);
         }
         return new ArrayList<>();
     }

          
@@ 129,7 132,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getCylinders", ex);
         }
         return new ArrayList<>();
     }

          
@@ 170,7 173,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getLayoutCylinderCombos", ex);
         }
         return new ArrayList<>();
     }

          
@@ 200,7 203,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getValvetrain", ex);
         }
         return new ArrayList<>();
     }

          
@@ 228,7 231,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getInductionSystem", ex);
         }
         return new ArrayList<>();
     }

          
@@ 257,7 260,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getChassisType", ex);
         }
         return new ArrayList<>();
     }

          
@@ 286,7 289,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getDrivetrain", ex);
         }
         return new ArrayList<>();
     }

          
@@ 318,7 321,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getSuspension", ex);
         }
         return new ArrayList<>();
     }

          
@@ 350,7 353,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getCombinedSuspension", ex);
         }
         return new ArrayList<>();
     }

          
@@ 379,7 382,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getGearboxType", ex);
         }
         return new ArrayList<>();
     }

          
@@ 408,7 411,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getGearCount", ex);
         }
         return new ArrayList<>();
     }

          
@@ 438,7 441,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getAverageGears", ex);
         }
         return new ArrayList<>();
     }

          
@@ 469,7 472,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getTopSpeedByType", ex);
         }
         return new ArrayList<>();
     }

          
@@ 500,7 503,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getSalesByType", ex);
         }
         return new ArrayList<>();
     }

          
@@ 529,7 532,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getAverageEmissions", ex);
         }
         return new ArrayList<>();
     }

          
@@ 560,7 563,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getEmissionsByFuelType", ex);
         }
         return new ArrayList<>();
     }

          
@@ 593,7 596,7 @@ public class MarketTrendsDataFetcherSeco
             return results;
         }
         catch(SQLException ex) {
-            System.err.println(ex);
+            logger.error("Error with getEmissionsByVehicleType", ex);
         }
         return new ArrayList<>();
     }

          
M src/main/java/com/ajtjp/gearcitydata/debt/BondArchiver.java +6 -3
@@ 9,6 9,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.log4j.Logger;
 
 /**
  * Fetches bonds from Gear City and caches them in our local database.

          
@@ 16,6 17,8 @@ import java.util.List;
  */
 public class BondArchiver {
     
+    static Logger logger = Logger.getLogger("com.ajtjp.gearCitydata.BondArchiver");
+    
     SecretaryDB secretaryDB;
     
     

          
@@ 50,7 53,7 @@ public class BondArchiver {
             
         }
         catch(SQLException ex) {
-            System.out.println("SQL Exception (Bonds): " + ex.getMessage());
+            logger.error("Error analyzing bonds", ex);
             return new ArrayList<BondResult>();
         }
         

          
@@ 102,7 105,7 @@ public class BondArchiver {
             stmt.execute();
         }
         catch(SQLException ex) {
-            System.out.println("SQLException when inserting new Secretary bond: " + ex.getMessage());
+            logger.error("Error inserting new Secretary bond", ex);
         }
     }
     

          
@@ 118,7 121,7 @@ public class BondArchiver {
             stmt.execute();
         }
         catch(SQLException ex) {
-            System.out.println("SQLException when updating Secretary bond: " + ex.getMessage());
+            logger.error("Error updating known bond", ex);
         }
     }
 }