Support environment variable to disable http requests logging.

This commit is contained in:
Mathias Gug 2016-05-19 17:30:17 -07:00
parent ce5ae411c1
commit 1635f7351d
2 changed files with 19 additions and 11 deletions

View File

@ -7,6 +7,12 @@ send the USR1 signal to its parent when it will be running and waiting for
requests. This could be used to upgrade osrm-routed to a new binary on the fly
without any service downtime - no incoming requests will be lost.
### DISABLE_ACCESS_LOGGING
If the DISABLE_ACCESS_LOGGING environment variable is set osrm-routed will
**not** log any http requests to standard output. This can be useful in high
traffic setup.
## HTTP API
`osrm-routed` supports only `GET` requests of the form. If you your response size

View File

@ -64,6 +64,7 @@ void RequestHandler::HandleRequest(const http::request &current_request, http::r
ltime = time(nullptr);
time_stamp = localtime(&ltime);
if(!std::getenv("DISABLE_ACCESS_LOGGING")) {
// log timestamp
util::SimpleLogger().Write()
<< (time_stamp->tm_mday < 10 ? "0" : "") << time_stamp->tm_mday << "-"
@ -75,6 +76,7 @@ void RequestHandler::HandleRequest(const http::request &current_request, http::r
<< current_request.referrer << (0 == current_request.referrer.length() ? "- " : " ")
<< current_request.agent << (0 == current_request.agent.length() ? "- " : " ")
<< request_string;
}
auto api_iterator = request_string.begin();
auto maybe_parsed_url = api::parseURL(api_iterator, request_string.end());