|
19 | 19 | import java.nio.file.DirectoryStream;
|
20 | 20 | import java.nio.file.Files;
|
21 | 21 | import java.nio.file.Path;
|
| 22 | +import java.util.Arrays; |
22 | 23 | import java.util.Map;
|
23 | 24 | import java.util.Map.Entry;
|
24 | 25 | import java.util.Properties;
|
@@ -56,6 +57,9 @@ public class M2ELogbackConfigurator extends BasicConfigurator implements Configu
|
56 | 57 | // This has to match the log directory in defaultLogbackConfiguration/logback.xml
|
57 | 58 | private static final String PROPERTY_LOG_DIRECTORY = "org.eclipse.m2e.log.dir"; //$NON-NLS-1$
|
58 | 59 |
|
| 60 | + // This has to match the log directory in defaultLogbackConfiguration/logback.xml |
| 61 | + private static final String PROPERTY_LOG_CONSOLE_THRESHOLD = "org.eclipse.m2e.log.console.threshold"; //$NON-NLS-1$ |
| 62 | + |
59 | 63 | @Override
|
60 | 64 | public void configure(LoggerContext lc) {
|
61 | 65 | // Bug 337167: Configuring Logback requires the state-location. If not yet initialized it will be initialized to the default value,
|
@@ -89,6 +93,11 @@ private synchronized void configureLogback(LoggerContext lc) {
|
89 | 93 | if(System.getProperty(PROPERTY_LOG_DIRECTORY, "").length() <= 0) { //$NON-NLS-1$
|
90 | 94 | System.setProperty(PROPERTY_LOG_DIRECTORY, stateDir.toAbsolutePath().toString());
|
91 | 95 | }
|
| 96 | + if(System.getProperty(PROPERTY_LOG_CONSOLE_THRESHOLD, "").length() <= 0) { //$NON-NLS-1$ |
| 97 | + if(Arrays.stream(Platform.getCommandLineArgs()).filter(s -> s.equals("-consolelog")).findAny().isPresent()) { |
| 98 | + System.setProperty(PROPERTY_LOG_CONSOLE_THRESHOLD, Level.DEBUG.levelStr); |
| 99 | + } |
| 100 | + } |
92 | 101 | loadConfiguration(lc, configFile.toUri().toURL());
|
93 | 102 |
|
94 | 103 | //Delete old logs in legacy logback plug-in's state location. Can sum up to 1GB of disk-space.
|
|
0 commit comments