Don't overwhelm vscode with error logs

Redirect them to a tmp file instead.
This commit is contained in:
Kris De Volder
2017-05-06 20:36:07 -07:00
parent 5c2738e358
commit 807bf5901a
6 changed files with 19 additions and 11 deletions

View File

@@ -23,6 +23,8 @@ import java.util.function.Function;
import org.reactivestreams.Publisher;
import org.springframework.ide.vscode.commons.cloudfoundry.client.v2.CancelationTokens.CancelationToken;
import org.springframework.ide.vscode.commons.util.ExceptionUtil;
import org.springframework.ide.vscode.commons.util.Log;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -64,7 +66,6 @@ public class ReactorUtils {
try {
return mono.block(DEFAULT_TIMEOUT);
} catch (Exception e) {
dumpStacks();
throw new IOException(e);
}
}
@@ -86,17 +87,15 @@ public class ReactorUtils {
// .otherwise(errorFilter(cancelationToken))
.block(timeout);
} catch (Exception e) {
dumpStacks();
Log.log(e);
throw new IOException(e);
}
}
public static <T> List<T> get(Duration t, Mono<List<T>> m) throws IOException {
try {
return m.block(t);
} catch (Exception e) {
dumpStacks();
throw new IOException(e);
}
}

View File

@@ -307,6 +307,10 @@ public class YTypeFactory {
}
}
public void sealHints() {
hints = ImmutableList.copyOf(hints);
}
private Collection<YValueHint> getProviderHints(DynamicSchemaContext dc) throws Exception {
if (hintProvider != null) {
Callable<Collection<YValueHint>> withContext = hintProvider.withContext(dc);

View File

@@ -13,10 +13,7 @@ package org.springframework.ide.vscode.manifest.yaml;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance;
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget;
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTargetCache;
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.ConnectionException;
@@ -33,8 +30,6 @@ public abstract class AbstractCFHintsProvider implements Callable<Collection<YVa
public static final String EMPTY_VALUE = "";
protected final CFTargetCache targetCache;
private static final Logger logger = Logger.getLogger(AbstractCFHintsProvider.class.getName());
public AbstractCFHintsProvider(CFTargetCache targetCache) {
Assert.isNotNull(targetCache);
this.targetCache = targetCache;
@@ -71,7 +66,7 @@ public abstract class AbstractCFHintsProvider implements Callable<Collection<YVa
throw new ValueParseException(ExceptionUtil.getMessageNoAppendedInformation(errorNoAppending));
} else {
// Log any other error
logger.log(Level.SEVERE, ExceptionUtil.getMessage(e), e);
//logger.log(Level.SEVERE, ExceptionUtil.getMessage(e), e);
throw new ValueParseException(
"Failed to get "+getTypeName()+"s from Cloud Foundry: "+ExceptionUtil.getMessage(e));
}

View File

@@ -10,6 +10,7 @@
*******************************************************************************/
package org.springframework.ide.vscode.manifest.yaml;
import java.io.File;
import java.io.IOException;
import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp;
@@ -17,8 +18,11 @@ import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguage
public class Main {
SimpleLanguageServer server = new ManifestYamlLanguageServer();
public static void main(String[] args) throws IOException, InterruptedException {
File logfile = File.createTempFile("manifest-yaml-language-server", ".log");
System.err.println("Redirecting log output to: "+logfile);
System.setProperty("org.slf4j.simpleLogger.logFile", logfile.toString());
LaunguageServerApp.start(ManifestYamlLanguageServer::new);
}
}

View File

@@ -16,6 +16,7 @@ import java.util.concurrent.Callable;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.commons.util.IntegerRange;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.Renderables;
import org.springframework.ide.vscode.commons.util.ValueParsers;
@@ -155,6 +156,7 @@ public class ManifestYmlSchema implements YamlSchema {
YAtomicType t_memory = f.yatomic("Memory");
t_memory.addHints("256M", "512M", "1024M");
t_memory.parseWith(ManifestYmlValueParsers.MEMORY);
t_memory.sealHints();
YAtomicType t_health_check_type = f.yenumBuilder("Health Check Type", "none", "process", "port", "http")
.deprecateWithReplacement("none", "process")

View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -e
npm install
npm run vsce-package