Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-01-30 10:40:29 -0500
committerThomas Watson2017-02-03 17:09:15 -0500
commit8fabc5c55da1e58516b5a3b2631a37414d4fbb63 (patch)
tree9f7b31fb6deb680978597a4da895a1c6595c9f9c
parentfcab3e35945c3d10db5b22838c1230c67afdaee2 (diff)
downloadrt.equinox.framework-8fabc5c55da1e58516b5a3b2631a37414d4fbb63.tar.gz
rt.equinox.framework-8fabc5c55da1e58516b5a3b2631a37414d4fbb63.tar.xz
rt.equinox.framework-8fabc5c55da1e58516b5a3b2631a37414d4fbb63.zip
Change-Id: Ib7ce9ab914f96f1ec739c8e88be8aaf4b6c269f2 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java39
1 files changed, 26 insertions, 13 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java
index 3a2fea17e..6d2378821 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2014 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@ import java.security.AccessController;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.eclipse.core.runtime.adaptor.EclipseStarter;
import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.service.debug.DebugTrace;
@@ -93,17 +94,7 @@ class EclipseDebugTrace implements DebugTrace {
/** DebugOptions are used to determine if the specified bundle symbolic name + option-path has debugging enabled */
private FrameworkDebugOptions debugOptions = null;
- /**
- * Construct a new EclipseDebugTrace for the specified bundle symbolic name and write messages to the specified
- * trace file. The DebugOptions object will be used to determine if tracing should occur.
- *
- * @param bundleSymbolicName The symbolic name of the bundle being traced
- * @param debugOptions Used to determine if the specified bundle symbolic name + option-path has tracing enabled
- */
- EclipseDebugTrace(final String bundleSymbolicName, final FrameworkDebugOptions debugOptions) {
-
- this(bundleSymbolicName, debugOptions, null);
- }
+ private final boolean consoleLog;
/**
* Construct a new EclipseDebugTrace for the specified bundle symbolic name and write messages to the specified
@@ -114,7 +105,7 @@ class EclipseDebugTrace implements DebugTrace {
* @param traceClass The class that the client is using to perform trace API calls
*/
EclipseDebugTrace(final String bundleSymbolicName, final FrameworkDebugOptions debugOptions, final Class<?> traceClass) {
-
+ this.consoleLog = "true".equals(debugOptions.getConfiguration().getConfiguration(EclipseStarter.PROP_CONSOLE_LOG)); //$NON-NLS-1$
this.traceClass = traceClass != null ? traceClass.getName() : null;
this.debugOptions = debugOptions;
this.bundleSymbolicName = bundleSymbolicName;
@@ -643,14 +634,36 @@ class EclipseDebugTrace implements DebugTrace {
/**
* @throws IOException
*/
+ @Override
public void close() throws IOException {
// We don't want to close System.out
}
+ @Override
public void write(byte[] var0, int var1, int var2) throws IOException {
this.out.write(var0, var1, var2);
}
};
+ } else if (consoleLog) {
+ out = new FilterOutputStream(out) {
+ @Override
+ public void write(int b) throws IOException {
+ System.out.write(b);
+ out.write(b);
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ System.out.write(b);
+ out.write(b);
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ System.out.write(b, off, len);
+ out.write(b, off, len);
+ }
+ };
}
return logForStream(out);
}

Back to the top