Skip to content

Commit cf78694

Browse files
authored
Merge pull request #181 from HSLdevcom/tagged-stops-logger
MAP-354 Add separate logger for tagged stops
2 parents d908d22 + 15eb58f commit cf78694

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ _site/
2929
/otp
3030
/otp-batch-analyst
3131
graphs/
32+
taggedStops.log

src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ the License, or (at your option) any later version.
4545
import org.opentripplanner.standalone.S3BucketConfig;
4646
import org.slf4j.Logger;
4747
import org.slf4j.LoggerFactory;
48+
import org.slf4j.MDC;
4849

4950
import java.io.File;
5051
import java.io.IOException;
@@ -109,10 +110,12 @@ public void setModes(List<RoutingRequest> modeList) {
109110
}
110111

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

115117
public void setPath (File path) {
118+
MDC.put("routerPath", path.getPath());
116119
graphFile = new File(path, "Graph.obj");
117120
}
118121

src/main/java/org/opentripplanner/graph_builder/module/TransitToTaggedStopsModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private boolean connectVertexToStop(TransitStop ts, boolean wheelchairAccessible
102102
if (tsv.stopCode != null && tsv.stopCode.equals(stopCode)) {
103103
new StreetTransitLink(ts, tsv, wheelchairAccessible);
104104
new StreetTransitLink(tsv, ts, wheelchairAccessible);
105-
LOG.debug("Connected " + ts.toString() + " to " + tsv.getLabel());
105+
LOG.debug("Connected " + ts.toString() + " (" + ts.getStopCode() + ") to " + tsv.getLabel() + " at " + tsv.getCoordinate().toString());
106106
return true;
107107
}
108108
}

src/main/resources/logback.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@
2222
<level>WARN</level>
2323
</filter>
2424
</appender>
25+
26+
<appender name="TaggedStopsLog" class="ch.qos.logback.classic.sift.SiftingAppender">
27+
<discriminator>
28+
<key>routerPath</key>
29+
<defaultValue>.</defaultValue>
30+
</discriminator>
31+
<sift>
32+
<appender name="TaggedStopsLog-${routerPath}" class="ch.qos.logback.core.FileAppender">
33+
<file>${routerPath}/taggedStops.log</file>
34+
<append>false</append>
35+
<!-- set immediateFlush to false for much higher logging throughput -->
36+
<immediateFlush>false</immediateFlush>
37+
<!-- encoders are assigned the type
38+
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
39+
<encoder>
40+
<pattern>%msg%n</pattern>
41+
</encoder>
42+
</appender>
43+
</sift>
44+
</appender>
45+
2546
<!-- Change this to debug to let more messages through. -->
2647
<root level="info">
2748
<appender-ref ref="stdout" />
@@ -54,5 +75,8 @@
5475
<logger name="com.sun.jersey" level="warn" />
5576
<!-- Suppress an inconsequential IOException that is logged at debug level. -->
5677
<logger name="org.glassfish.grizzly" level="info" />
78+
<logger name="org.opentripplanner.graph_builder.module.TransitToTaggedStopsModule" level="debug" additivity="false">
79+
<appender-ref ref="TaggedStopsLog"/>
80+
</logger>
5781

5882
</configuration>

0 commit comments

Comments
 (0)