diff options
3 files changed, 5 insertions, 57 deletions
diff --git a/org.eclipse.m2e.logback.appender/src/main/java/org/eclipse/m2e/logback/appender/ConsoleAppenderFilter.java b/org.eclipse.m2e.logback.appender/src/main/java/org/eclipse/m2e/logback/appender/ConsoleAppenderFilter.java deleted file mode 100644 index c7011093..00000000 --- a/org.eclipse.m2e.logback.appender/src/main/java/org/eclipse/m2e/logback/appender/ConsoleAppenderFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Sonatype, Inc. - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sonatype, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.m2e.logback.appender; - -import ch.qos.logback.classic.spi.ILoggingEvent; -import ch.qos.logback.core.filter.Filter; -import ch.qos.logback.core.spi.FilterReply; - -import org.eclipse.core.runtime.adaptor.EclipseStarter; -import org.eclipse.osgi.framework.internal.core.FrameworkProperties; - - -/** - * Filters out (disables) logging to console if -consoleLog was passed as arg to eclipse - */ -@SuppressWarnings("restriction") -public class ConsoleAppenderFilter extends Filter<ILoggingEvent> { - private boolean consoleLogEnabled; - - public ConsoleAppenderFilter() { - consoleLogEnabled = "true".equals(FrameworkProperties.getProperty(EclipseStarter.PROP_CONSOLE_LOG)); - } - - public FilterReply decide(ILoggingEvent loggingEvent) { - if(consoleLogEnabled) { - return FilterReply.NEUTRAL; - } - return FilterReply.DENY; - } -} diff --git a/org.eclipse.m2e.logback.configuration/defaultLogbackConfiguration/logback.xml b/org.eclipse.m2e.logback.configuration/defaultLogbackConfiguration/logback.xml index e0de5155..e33758c3 100644 --- a/org.eclipse.m2e.logback.configuration/defaultLogbackConfiguration/logback.xml +++ b/org.eclipse.m2e.logback.configuration/defaultLogbackConfiguration/logback.xml @@ -3,7 +3,9 @@ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern> </encoder> - <filter class="org.eclipse.m2e.logback.appender.ConsoleAppenderFilter"/> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>OFF</level> <!-- change to DEBUG to mimic '-consolelog' behaviour --> + </filter> </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> diff --git a/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/logback/configuration/LogPlugin.java b/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/logback/configuration/LogPlugin.java index afc6b6da..d6f05b00 100644 --- a/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/logback/configuration/LogPlugin.java +++ b/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/logback/configuration/LogPlugin.java @@ -34,11 +34,8 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.adaptor.EclipseStarter; -import org.eclipse.osgi.framework.internal.core.FrameworkProperties; -@SuppressWarnings("restriction") public class LogPlugin extends Plugin { private static final String PLUGIN_ID = "org.eclipse.m2e.logback.configuration"; //$NON-NLS-1$ @@ -100,9 +97,7 @@ public class LogPlugin extends Plugin { } private static void systemOut(String message) { - if("true".equals(FrameworkProperties.getProperty(EclipseStarter.PROP_CONSOLE_LOG))) { - System.out.println(PLUGIN_ID + ": " + message); //$NON-NLS-1$ - } + System.out.println(PLUGIN_ID + ": " + message); //$NON-NLS-1$ } private static void systemErr(String message) { @@ -189,17 +184,7 @@ public class LogPlugin extends Plugin { configurator.setContext(lc); configurator.doConfigure(configFile); - systemOut(EclipseStarter.PROP_CONSOLE_LOG + "=" + FrameworkProperties.getProperty(EclipseStarter.PROP_CONSOLE_LOG)); - boolean consoleLog = "true".equals(FrameworkProperties.getProperty(EclipseStarter.PROP_CONSOLE_LOG)); - if(consoleLog) { - StatusPrinter.printInCaseOfErrorsOrWarnings(lc); -// } else { -// Logger logger = (Logger) LoggerFactory.getLogger("root"); -// Appender consoleAppender = logger.getAppender("STDOUT"); -// if(consoleAppender != null && consoleAppender.isStarted()) { -// consoleAppender.stop(); -// } - } + StatusPrinter.printInCaseOfErrorsOrWarnings(lc); LogHelper.logJavaProperties(LoggerFactory.getLogger(LogPlugin.class)); } |