Search code examples
javaloggingroutesnavigationgraphhopper

GraphHopper .jar only log Errors, Bad Requests, etc


I'm using GrpahHopper's self hosted routing server v0.5, running on Ubuntu 15.10.

The solution is run via a terminal with a jar file and arbitrary OSM data.

Is there a way to control the logged output of the server (e.g. to only show exceptions, bad requests, etc.)?


Solution

  • For that you'll have to repackage GraphHopper as there is no 'outside' configuration option provided - raise an issue if you need this.

    Change the log4j.xml file under web/src/main/resources e.g. replace the root and com.graphhopper logger via the following snippet:

    <logger name="com.graphhopper" additivity="false">
        <level value="warn" />
        <appender-ref ref="ASYNC" />
    </logger>
    <root>
        <priority value="warn"></priority>
        <appender-ref ref="ASYNC"/>
    </root>
    

    Then repackage GH via the quickstart from source.

    Update it might be possible without repackaging via

    export JAVA_OPTS="-Dlog4j.debug -Dlog4j.configuration=some-log-config.xml"

    using the mentioned and updated log4j.xml but I've not tested this yet. See the log4j docs