tmf: Bug 497413: Abstract time graph view JUL logger incorrectly enabled
authorPatrick Tasse <patrick.tasse@gmail.com>
Thu, 14 Jul 2016 20:10:39 +0000 (16:10 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Tue, 19 Jul 2016 14:07:20 +0000 (10:07 -0400)
The time graph view abstract classes are changed to use their own class
when getting the logger so that they are in their own namespace and
inherit the Trace Compass parent logger's log level.

Change-Id: If117f307d8c12e601f26f97c57e6a26ba77311a6
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/77347
Reviewed-by: Hudson CI
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java

index e9ab7b250f5322ab8c8d2737ca0a48b79c5e6fd7..ab26e7dac6bec3818cbe55f8a8f1d1bd1bdde48f 100644 (file)
@@ -64,8 +64,7 @@ public abstract class AbstractStateSystemTimeGraphView extends AbstractTimeGraph
     /** The trace to state system multi map */
     private final Multimap<ITmfTrace, ITmfStateSystem> fTraceSSMap = HashMultimap.create();
 
-    /** Instance-specific logger, which will use the concrete class's name */
-    private final Logger fLogger = TraceCompassLog.getLogger(getClass());
+    private static final Logger LOGGER = TraceCompassLog.getLogger(AbstractStateSystemTimeGraphView.class);
 
     // ------------------------------------------------------------------------
     // Classes
@@ -123,7 +122,7 @@ public abstract class AbstractStateSystemTimeGraphView extends AbstractTimeGraph
                     getTimeGraphViewer().setMarkers(markers);
                 });
             } else {
-                fLogger.info(() -> "[TimeGraphView:ZoomThreadCanceled]"); //$NON-NLS-1$
+                LOGGER.info(() -> "[TimeGraphView:ZoomThreadCanceled]"); //$NON-NLS-1$
             }
         }
 
@@ -149,19 +148,19 @@ public abstract class AbstractStateSystemTimeGraphView extends AbstractTimeGraph
             queryFullStates(ss, start, end, resolution, monitor, new IQueryHandler() {
                 @Override
                 public void handle(@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState) {
-                    fLogger.config(() -> "[TimeGraphView:ZoomThreadGettingStates]"); //$NON-NLS-1$
+                    LOGGER.config(() -> "[TimeGraphView:ZoomThreadGettingStates]"); //$NON-NLS-1$
                     if (!fullRange) {
                         for (TimeGraphEntry entry : entryList) {
                             zoom(checkNotNull(entry), ss, fullStates, prevFullState, monitor);
                         }
                     }
                     /* Refresh the arrows when zooming */
-                    fLogger.config(() -> "[TimeGraphView:ZoomThreadGettingLinks]"); //$NON-NLS-1$
+                    LOGGER.config(() -> "[TimeGraphView:ZoomThreadGettingLinks]"); //$NON-NLS-1$
                     links.addAll(getLinkList(ss, fullStates, prevFullState, monitor));
                     /* Refresh the view-specific markers when zooming */
-                    fLogger.config(() -> "[TimeGraphView:ZoomThreadGettingMarkers]"); //$NON-NLS-1$
+                    LOGGER.config(() -> "[TimeGraphView:ZoomThreadGettingMarkers]"); //$NON-NLS-1$
                     markers.addAll(getViewMarkerList(ss, fullStates, prevFullState, monitor));
-                    fLogger.config(() -> "[TimeGraphView:ZoomThreadDone]"); //$NON-NLS-1$
+                    LOGGER.config(() -> "[TimeGraphView:ZoomThreadDone]"); //$NON-NLS-1$
                 }
             });
             refresh();
@@ -181,7 +180,7 @@ public abstract class AbstractStateSystemTimeGraphView extends AbstractTimeGraph
             }
             for (TimeGraphEntry child : entry.getChildren()) {
                 if (monitor.isCanceled()) {
-                    fLogger.info(() -> "[TimeGraphView:ZoomThreadCanceled]"); //$NON-NLS-1$
+                    LOGGER.info(() -> "[TimeGraphView:ZoomThreadCanceled]"); //$NON-NLS-1$
                     return;
                 }
                 zoom(child, ss, fullStates, prevFullState, monitor);
index 84d656dc9caacb3db2284c35d625c8ec23ab3a35..fc361c2247425b11346ae9159d720b0a350e458f 100644 (file)
@@ -144,8 +144,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
 
     private static final Pattern RGBA_PATTERN = Pattern.compile("RGBA \\{(\\d+), (\\d+), (\\d+), (\\d+)\\}"); //$NON-NLS-1$
 
-    /** Instance-specific logger, which will use the concrete class's name */
-    private final Logger fLogger = TraceCompassLog.getLogger(getClass());
+    private static final Logger LOGGER = TraceCompassLog.getLogger(AbstractTimeGraphView.class);
 
     /**
      * Redraw state enum
@@ -702,14 +701,14 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
 
         @Override
         public void run() {
-            fLogger.info(() -> "[TimeGraphView:BuildThreadStart] trace=" + fBuildTrace.getName()); //$NON-NLS-1$
+            LOGGER.info(() -> "[TimeGraphView:BuildThreadStart] trace=" + fBuildTrace.getName()); //$NON-NLS-1$
 
             buildEntryList(fBuildTrace, fParentTrace, fMonitor);
             synchronized (fBuildThreadMap) {
                 fBuildThreadMap.remove(fBuildTrace);
             }
 
-            fLogger.info(() -> "[TimeGraphView:BuildThreadEnd]"); //$NON-NLS-1$
+            LOGGER.info(() -> "[TimeGraphView:BuildThreadEnd]"); //$NON-NLS-1$
         }
 
         public void cancel() {
@@ -782,12 +781,12 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
 
         @Override
         public final void run() {
-            fLogger.info(() -> "[TimeGraphView:ZoomThreadStart] start=" + fZoomStartTime + ", end=" + fZoomEndTime); //$NON-NLS-1$ //$NON-NLS-2$
+            LOGGER.info(() -> "[TimeGraphView:ZoomThreadStart] start=" + fZoomStartTime + ", end=" + fZoomEndTime); //$NON-NLS-1$ //$NON-NLS-2$
 
             doRun();
             fDirty.decrementAndGet();
 
-            fLogger.info(() -> "[TimeGraphView:ZoomThreadEnd]"); //$NON-NLS-1$
+            LOGGER.info(() -> "[TimeGraphView:ZoomThreadEnd]"); //$NON-NLS-1$
         }
 
         /**
@@ -825,11 +824,11 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
 
         @Override
         public void doRun() {
-            fLogger.config(() -> "[TimeGraphView:ZoomThreadGettingStates]"); //$NON-NLS-1$
+            LOGGER.config(() -> "[TimeGraphView:ZoomThreadGettingStates]"); //$NON-NLS-1$
 
             for (TimeGraphEntry entry : fZoomEntryList) {
                 if (getMonitor().isCanceled()) {
-                    fLogger.info(() -> "[TimeGraphView:ZoomThreadCanceled]"); //$NON-NLS-1$
+                    LOGGER.info(() -> "[TimeGraphView:ZoomThreadCanceled]"); //$NON-NLS-1$
                     return;
                 }
                 if (entry == null) {
@@ -838,11 +837,11 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
                 zoom(entry, getMonitor());
             }
             /* Refresh the arrows when zooming */
-            fLogger.config(() -> "[TimeGraphView:ZoomThreadGettingLinks]"); //$NON-NLS-1$
+            LOGGER.config(() -> "[TimeGraphView:ZoomThreadGettingLinks]"); //$NON-NLS-1$
             List<ILinkEvent> events = getLinkList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor());
 
             /* Refresh the view-specific markers when zooming */
-            fLogger.config(() -> "[TimeGraphView:ZoomThreadGettingMarkers]"); //$NON-NLS-1$
+            LOGGER.config(() -> "[TimeGraphView:ZoomThreadGettingMarkers]"); //$NON-NLS-1$
             List<IMarkerEvent> markers = new ArrayList<>(getViewMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()));
             /* Refresh the trace-specific markers when zooming */
             markers.addAll(getTraceMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()));
@@ -1586,7 +1585,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
         }
         fTrace = trace;
 
-        fLogger.info(() -> "[TimeGraphView:LoadingTrace] trace=" + trace.getName()); //$NON-NLS-1$
+        LOGGER.info(() -> "[TimeGraphView:LoadingTrace] trace=" + trace.getName()); //$NON-NLS-1$
 
         restoreViewContext();
         fEditorFile = TmfTraceManager.getInstance().getTraceEditorFile(trace);
@@ -1809,12 +1808,12 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
      * Refresh the display
      */
     protected void refresh() {
-        fLogger.info(() -> "[TimeGraphView:RefreshRequested]"); //$NON-NLS-1$
+        LOGGER.info(() -> "[TimeGraphView:RefreshRequested]"); //$NON-NLS-1$
         final boolean zoomThread = Thread.currentThread() instanceof ZoomThread;
         TmfUiRefreshHandler.getInstance().queueUpdate(this, new Runnable() {
             @Override
             public void run() {
-                fLogger.info(() -> "[TimeGraphView:RefreshStart]"); //$NON-NLS-1$
+                LOGGER.info(() -> "[TimeGraphView:RefreshStart]"); //$NON-NLS-1$
                 if (fTimeGraphWrapper.isDisposed()) {
                     return;
                 }
@@ -1899,7 +1898,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
                     startZoomThread(startTime, endTime);
                 }
                 fDirty.decrementAndGet();
-                fLogger.info(() -> "[TimeGraphView:RefreshEnd]"); //$NON-NLS-1$
+                LOGGER.info(() -> "[TimeGraphView:RefreshEnd]"); //$NON-NLS-1$
             }
         });
     }
@@ -1916,11 +1915,11 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
                 return;
             }
         }
-        fLogger.info(() -> "[TimeGraphView:RedrawRequested]"); //$NON-NLS-1$
+        LOGGER.info(() -> "[TimeGraphView:RedrawRequested]"); //$NON-NLS-1$
         Display.getDefault().asyncExec(new Runnable() {
             @Override
             public void run() {
-                fLogger.info(() -> "[TimeGraphView:RedrawStart]"); //$NON-NLS-1$
+                LOGGER.info(() -> "[TimeGraphView:RedrawStart]"); //$NON-NLS-1$
                 if (fTimeGraphWrapper.isDisposed()) {
                     return;
                 }
@@ -1934,7 +1933,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
                         fRedrawState = State.IDLE;
                     }
                 }
-                fLogger.info(() -> "[TimeGraphView:RedrawEnd]"); //$NON-NLS-1$
+                LOGGER.info(() -> "[TimeGraphView:RedrawEnd]"); //$NON-NLS-1$
             }
         });
     }
This page took 0.031329 seconds and 5 git commands to generate.