Bug 538977 - JobManager tracing ignores output file
This change adjusts tracing in JobManager to write to a file, if a file
is specified by the tracing preferences.
Change-Id: Id7fb12a1308bf652307ee0f0b892ef216aa7f251
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
diff --git a/bundles/org.eclipse.core.jobs/.options b/bundles/org.eclipse.core.jobs/.options
index 801e822..46461d2 100644
--- a/bundles/org.eclipse.core.jobs/.options
+++ b/bundles/org.eclipse.core.jobs/.options
@@ -6,8 +6,6 @@
# Prints debug information on running background jobs
org.eclipse.core.jobs/jobs=false
-# Includes current date and time in job debug information
-org.eclipse.core.jobs/jobs/timing=false
# Prints debug information when scheduling rules begin and end, and for mismatched beginRule/endRule pairs
org.eclipse.core.jobs/jobs/beginend=false
# Pedantic assertion checking on locks and deadlock reporting
diff --git a/bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF
index 0f5a917..8cee9c5 100644
--- a/bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.jobs/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.jobs; singleton:=true
-Bundle-Version: 3.10.100.qualifier
+Bundle-Version: 3.10.200.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.core.internal.jobs;x-internal:=true,
diff --git a/bundles/org.eclipse.core.jobs/pom.xml b/bundles/org.eclipse.core.jobs/pom.xml
index b0d4208..7d422a1 100644
--- a/bundles/org.eclipse.core.jobs/pom.xml
+++ b/bundles/org.eclipse.core.jobs/pom.xml
@@ -5,7 +5,7 @@
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/org/documents/edl-v10.php
-
+
Contributors:
Igor Fedorenko - initial implementation
Lars Vogel <Lars.Vogel@gmail.com> - Bug 432078
@@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.jobs</artifactId>
- <version>3.10.100-SNAPSHOT</version>
+ <version>3.10.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<code.ignoredWarnings>-warn:-deprecation,raw,unchecked</code.ignoredWarnings>
diff --git a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java
index 98246db..1682841 100644
--- a/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java
+++ b/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/JobManager.java
@@ -22,14 +22,11 @@
*******************************************************************************/
package org.eclipse.core.internal.jobs;
-//don't use ICU because this is used for debugging only (see bug 135785)
-import java.text.*;
import java.util.*;
import org.eclipse.core.internal.runtime.RuntimeLog;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.eclipse.osgi.service.debug.DebugOptionsListener;
+import org.eclipse.osgi.service.debug.*;
import org.eclipse.osgi.util.NLS;
/**
@@ -73,19 +70,17 @@
private static final String OPTION_DEBUG_YIELDING = PI_JOBS + "/jobs/yielding"; //$NON-NLS-1$
private static final String OPTION_DEBUG_YIELDING_DETAILED = PI_JOBS + "/jobs/yielding/detailed"; //$NON-NLS-1$
private static final String OPTION_DEBUG_JOBS = PI_JOBS + "/jobs"; //$NON-NLS-1$
- private static final String OPTION_DEBUG_JOBS_TIMING = PI_JOBS + "/jobs/timing"; //$NON-NLS-1$
private static final String OPTION_LOCKS = PI_JOBS + "/jobs/locks"; //$NON-NLS-1$
private static final String OPTION_SHUTDOWN = PI_JOBS + "/jobs/shutdown"; //$NON-NLS-1$
+ static DebugTrace DEBUG_TRACE;
static boolean DEBUG = false;
static boolean DEBUG_BEGIN_END = false;
static boolean DEBUG_YIELDING = false;
static boolean DEBUG_YIELDING_DETAILED = false;
static boolean DEBUG_DEADLOCK = false;
static boolean DEBUG_LOCKS = false;
- static boolean DEBUG_TIMING = false;
static boolean DEBUG_SHUTDOWN = false;
- private static DateFormat DEBUG_FORMAT;
/**
* The singleton job manager instance. It must be a singleton because
@@ -204,16 +199,7 @@
private final InternalWorker internalWorker;
public static void debug(String msg) {
- StringBuffer msgBuf = new StringBuffer(msg.length() + 40);
- if (DEBUG_TIMING) {
- //lazy initialize to avoid overhead when not debugging
- if (DEBUG_FORMAT == null)
- DEBUG_FORMAT = new SimpleDateFormat("HH:mm:ss.SSS"); //$NON-NLS-1$
- DEBUG_FORMAT.format(new Date(), msgBuf, new FieldPosition(0));
- msgBuf.append('-');
- }
- msgBuf.append('[').append(Thread.currentThread()).append(']').append(msg);
- System.out.println(msgBuf.toString());
+ DEBUG_TRACE.trace(null, msg);
}
/**
@@ -1139,13 +1125,13 @@
@Override
public void optionsChanged(DebugOptions options) {
+ DEBUG_TRACE = options.newDebugTrace(PI_JOBS);
DEBUG = options.getBooleanOption(OPTION_DEBUG_JOBS, false);
DEBUG_BEGIN_END = options.getBooleanOption(OPTION_DEBUG_BEGIN_END, false);
DEBUG_YIELDING = options.getBooleanOption(OPTION_DEBUG_YIELDING, false);
DEBUG_YIELDING_DETAILED = options.getBooleanOption(OPTION_DEBUG_YIELDING_DETAILED, false);
DEBUG_DEADLOCK = options.getBooleanOption(OPTION_DEADLOCK_ERROR, false);
DEBUG_LOCKS = options.getBooleanOption(OPTION_LOCKS, false);
- DEBUG_TIMING = options.getBooleanOption(OPTION_DEBUG_JOBS_TIMING, false);
DEBUG_SHUTDOWN = options.getBooleanOption(OPTION_SHUTDOWN, false);
}