changeset 1200:ed17d02927c5

Add logging for exceptions in StorageCommand. Reviewed-by: neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-August/007753.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Fri, 02 Aug 2013 12:26:21 +0200
parents 1e59f46b6efa
children 4197ede6bd1a
files agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/StorageCommand.java
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/StorageCommand.java	Thu Aug 01 14:07:37 2013 -0400
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/StorageCommand.java	Fri Aug 02 12:26:21 2013 +0200
@@ -38,6 +38,8 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import com.redhat.thermostat.agent.cli.impl.locale.LocaleResources;
 import com.redhat.thermostat.common.ExitStatus;
@@ -47,12 +49,14 @@
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.tools.ApplicationException;
 import com.redhat.thermostat.common.tools.ApplicationState;
+import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.shared.config.Configuration;
 import com.redhat.thermostat.shared.config.InvalidConfigurationException;
 import com.redhat.thermostat.shared.locale.Translate;
 
 public class StorageCommand extends AbstractStateNotifyingCommand {
 
+    private static final Logger logger = LoggingUtils.getLogger(StorageCommand.class);
     private static final Translate<LocaleResources> t = LocaleResources.createLocalizer();
 
     private DBStartupConfiguration configuration;
@@ -114,6 +118,7 @@
             // rethrow
             throw e;
         } catch (Exception e) {
+            logger.log(Level.WARNING, e.getMessage(), e);
             getNotifier().fireAction(ApplicationState.FAIL, e);
         }
     }