Skip to content

Commit

Permalink
Write the log file to the graph path
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesj committed Oct 31, 2017
1 parent 72ef074 commit 15eb58f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ the License, or (at your option) any later version.
import org.opentripplanner.standalone.S3BucketConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -109,10 +110,12 @@ public void setModes(List<RoutingRequest> modeList) {
}

public void setPath (String path) {
MDC.put("routerPath", path);
graphFile = new File(path.concat("/Graph.obj"));
}

public void setPath (File path) {
MDC.put("routerPath", path.getPath());
graphFile = new File(path, "Graph.obj");
}

Expand Down
30 changes: 19 additions & 11 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,25 @@
</filter>
</appender>

<appender name="TaggedStopsLog" class="ch.qos.logback.core.FileAppender">
<file>taggedStops.log</file>
<append>false</append>
<!-- set immediateFlush to false for much higher logging throughput -->
<immediateFlush>false</immediateFlush>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
<appender name="TaggedStopsLog" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>routerPath</key>
<defaultValue>.</defaultValue>
</discriminator>
<sift>
<appender name="TaggedStopsLog-${routerPath}" class="ch.qos.logback.core.FileAppender">
<file>${routerPath}/taggedStops.log</file>
<append>false</append>
<!-- set immediateFlush to false for much higher logging throughput -->
<immediateFlush>false</immediateFlush>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
</sift>
</appender>

<!-- Change this to debug to let more messages through. -->
<root level="info">
Expand Down

0 comments on commit 15eb58f

Please sign in to comment.