Skip to content

Commit

Permalink
Only log STDERR again.
Browse files Browse the repository at this point in the history
Some components seem to dump stack traces to STDERR, so we only write it
to the log file as it was before the new logging.
  • Loading branch information
thvitt committed Jul 1, 2016
1 parent 8df31e8 commit 896f955
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.MarkerManager;
import org.apache.logging.log4j.io.IoBuilder;
import org.apache.uima.UIMAException;
import org.apache.uima.analysis_component.AnalysisComponent;
import org.apache.uima.analysis_engine.AnalysisEngineDescription;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.collection.CollectionReaderDescription;
import org.apache.uima.fit.component.NoOpAnnotator;
import org.apache.uima.fit.pipeline.SimplePipeline;
Expand Down Expand Up @@ -434,8 +436,8 @@ public static void main(String[] args) {
logger.debug("==== Starting new session ====");
logger.debug("Arguments: " + Joiner.on(' ').join(args));

System.setErr(IoBuilder.forLogger(logger.getName() + ".stderr").setLevel(Level.WARN).buildPrintStream());
System.setOut(IoBuilder.forLogger(logger.getName() + ".stdout").setLevel(Level.INFO).buildPrintStream());
System.setErr(IoBuilder.forLogger(logger.getName() + ".stderr").setLevel(Level.WARN).setMarker(MarkerManager.getMarker("STDERR")).buildPrintStream());
System.setOut(IoBuilder.forLogger(logger.getName() + ".stdout").setLevel(Level.INFO).setMarker(MarkerManager.getMarker("STDOUT")).buildPrintStream());

try {
if(!parseArgs(args)) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
alwaysWriteExceptions="false"
noConsoleNoAnsi="true"
pattern="%highlight{%level:} %msg%replace{%throwable{short.className}}{.+}{ See error.log for more details.}%n"/>
<Filters>
<MarkerFilter marker="STDERR" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
</Console>
<File name="File" fileName="error.log">
<PatternLayout pattern="%date{ISO8601}\t%level\t%logger\t%msg%n%xEx{full}"/>
Expand Down

0 comments on commit 896f955

Please sign in to comment.