Author: rombert Date: Fri Oct 10 20:25:57 2014 New Revision: 1630977 URL: http://svn.apache.org/r1630977 Log: SLING-4028 - Allow printing tracing output to the console
All bundles now have a /debug/console flag which, when enabled, instructs the Tracer to also print the trace messages on System.out . Modified: sling/trunk/tooling/ide/eclipse-core/.options sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java sling/trunk/tooling/ide/eclipse-m2e-ui/.options sling/trunk/tooling/ide/eclipse-ui/.options sling/trunk/tooling/ide/impl-vlt/.options Modified: sling/trunk/tooling/ide/eclipse-core/.options URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/.options?rev=1630977&r1=1630976&r2=1630977&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/.options (original) +++ sling/trunk/tooling/ide/eclipse-core/.options Fri Oct 10 20:25:57 2014 @@ -1 +1,2 @@ -org.apache.sling.ide.eclipse-core/debug=false \ No newline at end of file +org.apache.sling.ide.eclipse-core/debug=false +org.apache.sling.ide.eclipse-core/debug/console=false \ No newline at end of file Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java?rev=1630977&r1=1630976&r2=1630977&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java (original) +++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java Fri Oct 10 20:25:57 2014 @@ -16,6 +16,8 @@ */ package org.apache.sling.ide.eclipse.core.debug.impl; +import java.util.Date; + import org.apache.sling.ide.log.Logger; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Plugin; @@ -32,6 +34,7 @@ public class Tracer implements DebugOpti private final Plugin plugin; private boolean debugEnabled; + private boolean consoleEnabled; private DebugTrace trace; public Tracer(Plugin plugin) { @@ -44,18 +47,31 @@ public class Tracer implements DebugOpti String pluginId = plugin.getBundle().getSymbolicName(); debugEnabled = options.getBooleanOption(pluginId + "/debug", false); + consoleEnabled = options.getBooleanOption(pluginId + "/debug/console", false) && debugEnabled; trace = options.newDebugTrace(pluginId, getClass()); } @Override public void trace(String message, Object... arguments) { - if ( !debugEnabled ) - return; - + + if (!debugEnabled) + return; + if ( arguments.length > 0 ) message = NLS.bind(message, arguments); trace.trace("/debug", message); + + if (consoleEnabled) + writeToConsole(message, null); + } + + private void writeToConsole(String message, Throwable t) { + + System.out.println("[" + Thread.currentThread().getName() + "] " + new Date() + " " + + plugin.getBundle().getSymbolicName() + " : " + message); + if (t != null) + t.printStackTrace(System.out); } @Override @@ -64,6 +80,9 @@ public class Tracer implements DebugOpti return; trace.trace("/debug", message, error); + + if (consoleEnabled) + writeToConsole(message, error); } @Override Modified: sling/trunk/tooling/ide/eclipse-m2e-ui/.options URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/.options?rev=1630977&r1=1630976&r2=1630977&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-m2e-ui/.options (original) +++ sling/trunk/tooling/ide/eclipse-m2e-ui/.options Fri Oct 10 20:25:57 2014 @@ -1 +1,2 @@ -org.apache.sling.ide.eclipse-m2e-ui/debug=false \ No newline at end of file +org.apache.sling.ide.eclipse-m2e-ui/debug=false +org.apache.sling.ide.eclipse-m2e-ui/debug/console=false \ No newline at end of file Modified: sling/trunk/tooling/ide/eclipse-ui/.options URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/.options?rev=1630977&r1=1630976&r2=1630977&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/.options (original) +++ sling/trunk/tooling/ide/eclipse-ui/.options Fri Oct 10 20:25:57 2014 @@ -1 +1,2 @@ -org.apache.sling.ide.eclipse-ui/debug=false \ No newline at end of file +org.apache.sling.ide.eclipse-ui/debug=false +org.apache.sling.ide.eclipse-ui/debug/console=false \ No newline at end of file Modified: sling/trunk/tooling/ide/impl-vlt/.options URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/.options?rev=1630977&r1=1630976&r2=1630977&view=diff ============================================================================== --- sling/trunk/tooling/ide/impl-vlt/.options (original) +++ sling/trunk/tooling/ide/impl-vlt/.options Fri Oct 10 20:25:57 2014 @@ -1 +1,2 @@ -org.apache.sling.ide.impl-vlt/debug=false \ No newline at end of file +org.apache.sling.ide.impl-vlt/debug=false +org.apache.sling.ide.impl-vlt/debug/console=false \ No newline at end of file