Strabon

changeset 249:0a24caace3a5

added logging to Strabon of MonetDB
author Babis Nikolaou <charnik@di.uoa.gr>
date Mon Jun 04 22:19:39 2012 +0300 (2012-06-04)
parents daf3442089bb
children a05e91b214cd
files runtime/src/main/java/eu/earthobservatory/runtime/monetdb/Strabon.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/Strabon.java	Mon Jun 04 22:15:17 2012 +0300
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/Strabon.java	Mon Jun 04 22:19:39 2012 +0300
     1.3 @@ -6,10 +6,15 @@
     1.4  import java.sql.SQLException;
     1.5  
     1.6  import org.openrdf.sail.monetdb.MonetDBSqlStore;
     1.7 +import org.slf4j.Logger;
     1.8 +import org.slf4j.LoggerFactory;
     1.9  
    1.10  public class Strabon extends eu.earthobservatory.runtime.generaldb.Strabon {
    1.11 +	
    1.12 +	private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.runtime.monetdb.Strabon.class);
    1.13  
    1.14 -	public Strabon(String databaseName, String user, String password, int port, String serverName, boolean checkForLockTable) throws SQLException, ClassNotFoundException {
    1.15 +	public Strabon(String databaseName, String user, String password, int port, 
    1.16 +			String serverName, boolean checkForLockTable) throws SQLException, ClassNotFoundException {
    1.17  		super(databaseName, user, password, port, serverName, checkForLockTable);
    1.18  	}
    1.19  
    1.20 @@ -30,14 +35,14 @@
    1.21  		monetDB_store.setServerName(serverName);
    1.22  		monetDB_store.setMaxNumberOfTripleTables(2048);
    1.23  		init();
    1.24 -		System.out.println("[Strabon] Initiatation completed.");
    1.25 +		logger.info("[Strabon] Initialization completed.");
    1.26  	}
    1.27  
    1.28  
    1.29  	protected void checkAndDeleteLock(String databaseName, String user, String password, int port, String serverName) throws SQLException, ClassNotFoundException {
    1.30  		String url = "";
    1.31  		try {
    1.32 -			System.out.println("[Strabon] Cleaning...");
    1.33 +			logger.info("[Strabon] Cleaning...");
    1.34  			Class.forName("nl.cwi.monetdb.jdbc.MonetDriver");
    1.35  			url = "jdbc:monetdb://" + serverName + ":" + port + "/"
    1.36  			+ databaseName + "?user=" + user + "&password=" + password;
    1.37 @@ -50,13 +55,10 @@
    1.38  			st.close();
    1.39  			conn.close();
    1.40  		} catch (SQLException e) {
    1.41 -			System.err.println("SQL Exception occured.");
    1.42 -			System.err.println("Connection url: " + url);
    1.43 -			e.printStackTrace();
    1.44 +			logger.error("SQL Exception occured. Connection URL: " + url, e);
    1.45  			throw e;
    1.46  		} catch (ClassNotFoundException e) {
    1.47 -			System.err.println("Could not load postgres jdbc driver...");
    1.48 -			e.printStackTrace();
    1.49 +			logger.error("Could not load monetdb jdbc driver...", e);
    1.50  			throw e;
    1.51  		}
    1.52  	}