Skip to content

Commit

Permalink
Merge pull request #181 from HSLdevcom/tagged-stops-logger
Browse files Browse the repository at this point in the history
MAP-354 Add separate logger for tagged stops
  • Loading branch information
siren authored Oct 31, 2017
2 parents d908d22 + 15eb58f commit cf78694
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ _site/
/otp
/otp-batch-analyst
graphs/
taggedStops.log
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private boolean connectVertexToStop(TransitStop ts, boolean wheelchairAccessible
if (tsv.stopCode != null && tsv.stopCode.equals(stopCode)) {
new StreetTransitLink(ts, tsv, wheelchairAccessible);
new StreetTransitLink(tsv, ts, wheelchairAccessible);
LOG.debug("Connected " + ts.toString() + " to " + tsv.getLabel());
LOG.debug("Connected " + ts.toString() + " (" + ts.getStopCode() + ") to " + tsv.getLabel() + " at " + tsv.getCoordinate().toString());
return true;
}
}
Expand Down
24 changes: 24 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@
<level>WARN</level>
</filter>
</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">
<appender-ref ref="stdout" />
Expand Down Expand Up @@ -54,5 +75,8 @@
<logger name="com.sun.jersey" level="warn" />
<!-- Suppress an inconsequential IOException that is logged at debug level. -->
<logger name="org.glassfish.grizzly" level="info" />
<logger name="org.opentripplanner.graph_builder.module.TransitToTaggedStopsModule" level="debug" additivity="false">
<appender-ref ref="TaggedStopsLog"/>
</logger>

</configuration>

0 comments on commit cf78694

Please sign in to comment.