Add logger and logging

- fix exception printing that goes nowhere
- make logger available for subclasses to use
This commit is contained in:
Tom Morris 2013-03-11 13:14:20 -04:00
parent a2a8f4af2e
commit 7578d3375f

View File

@ -44,6 +44,8 @@ import java.util.Properties;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.json.JSONWriter; import org.json.JSONWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.refine.Jsonizable; import com.google.refine.Jsonizable;
import com.google.refine.model.Cell; import com.google.refine.model.Cell;
@ -54,6 +56,8 @@ import com.google.refine.model.Row;
import edu.mit.simile.butterfly.ButterflyModule; import edu.mit.simile.butterfly.ButterflyModule;
abstract public class ReconConfig implements Jsonizable { abstract public class ReconConfig implements Jsonizable {
final static protected Logger LOGGER = LoggerFactory.getLogger("recon-config");
static final public Map<String, List<Class<? extends ReconConfig>>> s_opNameToClass = static final public Map<String, List<Class<? extends ReconConfig>>> s_opNameToClass =
new HashMap<String, List<Class<? extends ReconConfig>>>(); new HashMap<String, List<Class<? extends ReconConfig>>>();
@ -96,7 +100,7 @@ abstract public class ReconConfig implements Jsonizable {
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOGGER.error("Reconstruct failed",e);
} }
return null; return null;
} }
@ -122,7 +126,7 @@ abstract public class ReconConfig implements Jsonizable {
try { try {
write(jsonWriter, new Properties()); write(jsonWriter, new Properties());
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); LOGGER.error("Save failed",e);
} }
} }
} }