Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env var or flag to enable debug logs #3427

Open
midhunkrishna opened this issue Dec 8, 2016 · 3 comments
Open

env var or flag to enable debug logs #3427

midhunkrishna opened this issue Dec 8, 2016 · 3 comments

Comments

@midhunkrishna
Copy link

midhunkrishna commented Dec 8, 2016

The problem:

I have an OSRM server running in production and returning 207 error code. Now, if I look into the log file, the data is not very useful in debugging what might be the reason why this is happening ( since log level is info ).

From the issues on this repo itself, to get debug logs, I have to recompile the binary with debug flags. This, of course, is not an option with the production server.

If there is an option to toggle the log level via an ENV variable or a flag, that will be helpful.

@danpat
Copy link
Member

danpat commented Dec 8, 2016

We never return code 207, we only return 200, 400 and 500. I suspect debug logging would not help you here, it sounds like your requests are not making it to the server.

OSRM debug logging is currently disabled at compile time, for performance reasons. If I get a chance, I'll do some profiling - measure the cost of enabled-but-not-visible debug log messages. If the hit is negligible, we could consider doing this and making logDEBUG always compiled in, but not visible by default.

@wangyoucao577
Copy link
Contributor

@danpat I did some profiling for the enable/disable compile control for the debug logs:

Test env

  • aws r5.2xlarge (8 cpus, 64GB memory)
  • latest us-west OSM, about 1.7GB
  • osrm binaries build type: default(i.e. -DCMAKE_BUILD_TYPE=Release)
  • algorithm: MLD
  • commands
    • time osrm-extract -p osrm-backend/profiles/car.lua us-west-latest.osm.pbf >1.log 2>&1
    • time osrm-partition us-west-latest.osrm >2.log 2>&1
    • time osrm-customize us-west-latest.osrm >3.log 2>&1
    • NOTE: use >1.log 2>&1 redirect logs to file to reduce output to possiblity bad performance on write to stdout/stderr.

Benchmark

branch/commit osrm-extract osrm-partition osrm-customize
master-68dcab7 real 8m39.028s
user 41m53.692s
sys 1m13.904s
real 5m11.227s
user 26m24.147s
sys 0m24.994s
real 1m16.134s
user 7m5.574s
sys 0m10.759s
feature-1ada466 real 8m38.764s
user 41m49.624s
sys 1m13.393s
real 5m12.573s
user 26m9.168s
sys 0m29.120s
real 1m15.741s
user 7m2.858s
sys 0m10.665s
feature-1ada466
with extra flag -l DEBUG
real 8m42.247s
user 41m56.933s
sys 1m12.340s

output debug logs: 1459
real 5m12.860s
user 26m27.149s
sys 0m24.648s

output debug logs: 1
real 1m15.749s
user 7m3.277s
sys 0m10.805s

output debug logs: 0

The only differences between master-68dcab7 and feature-1ada466 is the commit 1ada4660817139c436e9afe13e8360d2458dc5c3 which removes compile-time-control for debug log.

Conclusion

  • There's no significant time cost increasing by remove the compile-time-control for debug log, performance is acceptable.
  • Also, the debug logs are are not mass(only totally 1460 for 1.7GB us-west OSM), it will NOT affect a lot of performance in theory.

I think it's totally ok to remove the compile-time-control for debug log based on above benchmark. I'll try to file a PR to remove the compile-time-control since the debug logs are very helpful for issues analysis.

@wangyoucao577
Copy link
Contributor

@midhunkrishna Now you can always compile your release mode binary with -DENABLE_DEBUG_LOGGING=ON on latest master. Then you're able to get debug log by runtime option -l DEBUG on production env without recompiling.

datendelphin added a commit to fossgis-routing-server/osrm-backend that referenced this issue Nov 19, 2020
  - Changes from 5.22.0
    - Build:
      - FIXED: pessimistic calls to std::move [Project-OSRM#5560](Project-OSRM#5561)
    - Features:
      - ADDED: new API parameter - `snapping=any|default` to allow snapping to previously unsnappable edges [Project-OSRM#5361](Project-OSRM#5361)
      - ADDED: keepalive support to the osrm-routed HTTP server [Project-OSRM#5518](Project-OSRM#5518)
      - ADDED: flatbuffers output format support [Project-OSRM#5513](Project-OSRM#5513)
      - ADDED: Global 'skip_waypoints' option [Project-OSRM#5556](Project-OSRM#5556)
      - FIXED: Install the libosrm_guidance library correctly [Project-OSRM#5604](Project-OSRM#5604)
      - FIXED: Http Handler can now deal witch optional whitespace between header-key and -value [Project-OSRM#5606](Project-OSRM#5606)
    - Routing:
      - CHANGED: allow routing past `barrier=arch` [Project-OSRM#5352](Project-OSRM#5352)
      - CHANGED: default car weight was reduced to 2000 kg. [Project-OSRM#5371](Project-OSRM#5371)
      - CHANGED: default car height was reduced to 2 meters. [Project-OSRM#5389](Project-OSRM#5389)
      - FIXED: treat `bicycle=use_sidepath` as no access on the tagged way. [Project-OSRM#5622](Project-OSRM#5622)
      - FIXED: fix table result when source and destination on same one-way segment. [Project-OSRM#5828](Project-OSRM#5828)
      - FIXED: fix occasional segfault when swapping data with osrm-datastore and using `exclude=` [Project-OSRM#5844](Project-OSRM#5844)
      - FIXED: fix crash in MLD alternative search if source or target are invalid [Project-OSRM#5851](Project-OSRM#5851)
    - Misc:
      - CHANGED: Reduce memory usage for raster source handling. [Project-OSRM#5572](Project-OSRM#5572)
      - CHANGED: Add cmake option `ENABLE_DEBUG_LOGGING` to control whether output debug logging. [Project-OSRM#3427](Project-OSRM#3427)
      - CHANGED: updated extent of Hong Kong as left hand drive country. [Project-OSRM#5535](Project-OSRM#5535)
      - FIXED: corrected error message when failing to snap input coordinates [Project-OSRM#5846](Project-OSRM#5846)
    - Infrastructure
      - REMOVED: STXXL support removed as STXXL became abandonware. [Project-OSRM#5760](Project-OSRM#5760)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants