This is an automated email from the git hooks/post-receive script. New commit to branch feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit 7baa9b58b47f172775343ad51bac60eb8a5d6c5b Author: servantie <servantie.c@gmail.com> Date: Thu Jun 23 11:19:04 2016 +0200 surrounded log.debug to only generate if Debug is enabled --- .../org/chorem/jtimer/data/TimerDataManager.java | 8 ++- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 5 +- .../chorem/jtimer/io/TimerTaskSynchronizer.java | 32 ++++++--- .../jtimer/ui/report/TimerTaskUpdaterView.java | 84 +++++++++++++++------- 4 files changed, 91 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/data/TimerDataManager.java b/src/main/java/org/chorem/jtimer/data/TimerDataManager.java index 46e79dd..df9d8c0 100644 --- a/src/main/java/org/chorem/jtimer/data/TimerDataManager.java +++ b/src/main/java/org/chorem/jtimer/data/TimerDataManager.java @@ -646,7 +646,9 @@ public class TimerDataManager { for (DataEventListener dataEventListener : dataEventListeners) { dataEventListener.changeSyncInfo(task, url); } - log.info("SyncInfo changed: " + url); + if (log.isDebugEnabled()) { + log.debug("SyncInfo changed: " + url); + } } /** @@ -659,6 +661,8 @@ public class TimerDataManager { for (DataEventListener dataEventListener : dataEventListeners) { dataEventListener.deleteSyncInfo(task, url); } - log.info("SyncInfo deleted: " + url); + if (log.isDebugEnabled()) { + log.debug("SyncInfo deleted: " + url); + } } } diff --git a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java index 720b82e..91c2d11 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java @@ -627,7 +627,9 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, try { date = LocalDateTime.parse(urlArray[2], formatter); } catch (DateTimeParseException e) { - log.error("Error parsing SyncTime for " + urlArray[0]); + if (log.isErrorEnabled()) { + log.error("Error parsing SyncTime for " + urlArray[0]); + } } if ("true".equals(urlArray[1])) { task.addSyncInfo(urlArray[0], date, true); @@ -1170,6 +1172,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, out.write("false "); } //write lastsync + //todo: remove the milliseconds if (sync.getLastSync().isAfter(LocalDateTime.MIN)) { out.write(sync.getLastSync().toString() + "\n"); } diff --git a/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java b/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java index 5063ce9..42c83cf 100644 --- a/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java +++ b/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java @@ -119,16 +119,22 @@ public class TimerTaskSynchronizer implements DataEventListener { successfulSync = true; } else if (SyncResult == 0) { - log.debug("Error in connection " + syncURL); + if (log.isDebugEnabled()) { + log.debug("Error in connection " + syncURL); + } } //sync successful -> change the last sync time if (successfulSync) { - log.debug("Sync successful on " + syncURL); + if (log.isDebugEnabled()) { + log.debug("Sync successful on " + syncURL); + } task.setLastSync(LocalDateTime.now(), syncURL); } //-> do not change last sync time else { - log.debug("Sync failed on " + syncURL); + if (log.isDebugEnabled()) { + log.debug("Sync failed on " + syncURL); + } } } @@ -161,15 +167,25 @@ public class TimerTaskSynchronizer implements DataEventListener { connection.getOutputStream().write(postDataBytes); upDateValue = connection.getResponseCode(); } catch (MalformedURLException e) { - log.error("URL malformed : " + syncURL); + if (log.isErrorEnabled()) { + log.error("URL malformed : " + syncURL); + } } catch (ProtocolException e) { - log.error("Protocol error."); + if (log.isErrorEnabled()) { + log.error("Protocol error."); + } } catch (UnsupportedEncodingException e) { - log.error("Problem with encoding " + syncURL); + if (log.isErrorEnabled()) { + log.error("Problem with encoding " + syncURL); + } } catch (IOException e) { - log.error("Problem with the connection " + syncURL); + if (log.isErrorEnabled()) { + log.error("Problem with the connection " + syncURL); + } }catch (IllegalArgumentException e) { - log.error("Port value not valid " + syncURL); + if (log.isErrorEnabled()) { + log.error("Port value not valid " + syncURL); + } } return upDateValue; } diff --git a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java index e912b4d..c45ada3 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java @@ -238,10 +238,14 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, if ((lastSyncTime != null) && lastSyncTime.isAfter(LocalDateTime.MIN)) { lastUpdate.setText(lastSyncTime.toString()); //logging change of lastSync - log.info("Last Sync time loaded : " + lastSyncTime.toString()); + if (log.isDebugEnabled()) { + log.debug("Last Sync time loaded : " + lastSyncTime.toString()); + } } else { - log.info("No Last Sync time loaded"); + if (log.isDebugEnabled()) { + log.debug("No Last Sync time loaded"); + } } checkIsActiveSync.setSelected(task.getSynchronizingInfo((String) urlComboBox.getSelectedItem()).getActiveSync()); } @@ -446,7 +450,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, public boolean isActiveSync() { boolean isActiveSyncURL = checkIsActiveSync.isSelected(); task.getSynchronizingInfo((String) urlComboBox.getSelectedItem()).setIsActiveSync(isActiveSyncURL); - log.info("Activity of url changed "); + if (log.isDebugEnabled()) { + log.debug("Activity of url changed "); + } return isActiveSyncURL; } @@ -498,23 +504,33 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, boolean hasUpdated = false; if ((syncAnswer == 200) || (syncAnswer == 201) || (syncAnswer == 202)) { hasUpdated = true; - log.info("Update accepted for URL : " + syncURL); - } + if (log.isDebugEnabled()) { + log.debug("Update accepted for URL : " + syncURL); + } + } else if (syncAnswer == 400) { - log.debug("Bad Request for URL : " + syncURL); - message = getResourceMap().getString("action.update400"); + if (log.isDebugEnabled()) { + log.debug("Bad Request for URL : " + syncURL); + } + message = getResourceMap().getString("action.update400"); } else if (syncAnswer == 404) { - log.debug("URL Not Found : " + syncURL); - message = getResourceMap().getString("action.update404"); + if (log.isDebugEnabled()) { + log.debug("URL Not Found : " + syncURL); + } + message = getResourceMap().getString("action.update404"); } else if (syncAnswer == 500) { - log.debug("Server Error on URL : " + syncURL); - message = getResourceMap().getString("action.update500"); + if (log.isDebugEnabled()) { + log.debug("Server Error on URL : " + syncURL); + } + message = getResourceMap().getString("action.update500"); } else { - log.debug("Error"); - message = getResourceMap().getString("action.updateError"); + if (log.isDebugEnabled()) { + log.debug("Error"); + } + message = getResourceMap().getString("action.updateError"); } if (hasUpdated) { task.setLastSync(LocalDateTime.now(), syncURL); @@ -572,7 +588,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, urlComboBox.addItem(urlToAdd); task.addSyncInfo(urlToAdd); core.getData().changeSyncInfo(task, urlToAdd); - log.info("New SyncInfo with URL : " + urlToAdd); + if (log.isDebugEnabled()) { + log.debug("New SyncInfo with URL : " + urlToAdd); + } } } @@ -583,7 +601,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, if (urlComboBox.getSelectedItem() != null) { String urlToDisplay = urlComboBox.getSelectedItem().toString(); if (!urlToDisplay.isEmpty()) { - log.info("Selected an object : " + urlComboBox.getSelectedItem().toString()); + if (log.isDebugEnabled()) { + log.debug("Selected an object : " + urlComboBox.getSelectedItem().toString()); + } //display last Sync Time if (lastUpdate != null && task.getSynchronizingInfo(urlToDisplay).getLastSync() != null) { if (task.getSynchronizingInfo(urlToDisplay).getLastSync().isAfter(LocalDateTime.MIN)) { @@ -605,20 +625,28 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, if (actionCommand.equals("comboBox")) { String urlToAdd = (String) urlComboBox.getSelectedItem(); if (!task.getSynchronizingURLList().contains(urlToAdd)) { - log.info("New URL detected !"); + if (log.isDebugEnabled()) { + log.debug("New URL detected !"); + } itemAdded(); } } - else if (actionCommand.equals("comboBoxChanged")) { - log.info("There has been a change in the comboBox"); - - } - else if (actionCommand.equals("comboBoxEdited")) { - log.info("The comboBox was edited"); - } - else if (actionCommand.equals(getResourceMap().getString("isActiveSync.Action.text"))) { - log.info("Checkbox ticked, unticked"); - } +// else if (actionCommand.equals("comboBoxChanged")) { +// if (log.isDebugEnabled()) { +// log.debug("There has been a change in the comboBox"); +// } +// +// } +// else if (actionCommand.equals("comboBoxEdited")) { +// if (log.isDebugEnabled()) { +// log.debug("The comboBox was edited"); +// } +// } +// else if (actionCommand.equals(getResourceMap().getString("isActiveSync.Action.text"))) { +// if (log.isDebugEnabled()) { +// log.debug("Checkbox ticked, unticked"); +// } +// } else if (actionCommand.equals("deleteURL")) { String urlToUse = (String) urlComboBox.getSelectedItem(); //if the delete button has been clicked, delete the task (if it exists) @@ -632,7 +660,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, } } else { - log.info("Action performed, not a new URL. Action: " + actionEvent.getActionCommand()); + if (log.isDebugEnabled()) { + log.debug("Action performed, not a new URL. Action: " + actionEvent.getActionCommand()); + } } } } \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.