Improve log messages for HTTP requests

refs #9074
This commit is contained in:
Gunnar Beutner 2015-09-30 08:41:09 +02:00
parent 00712f1902
commit 7e4953dd35
5 changed files with 10 additions and 7 deletions

View File

@ -71,9 +71,12 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
if (!listener)
return Empty;
String objType = params->Get("type");
String objName = params->Get("name");
if (!listener->GetAcceptConfig()) {
Log(LogWarning, "ApiListener")
<< "Ignoring config update. '" << listener->GetName() << "' does not accept config.";
<< "Ignoring config update for object '" << objName << "' of type '" << objType << "'. '" << listener->GetName() << "' does not accept config.";
return Empty;
}
@ -99,8 +102,6 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
}
/* update the object */
String objType = params->Get("type");
String objName = params->Get("name");
int objVersion = Convert::ToLong(params->Get("version"));
ConfigType::Ptr dtype = ConfigType::GetByName(objType);

View File

@ -367,7 +367,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
}
if (ctype == ClientJsonRpc) {
Log(LogInformation, "ApiListener", "New JSON-RPC client");
Log(LogNotice, "ApiListener", "New JSON-RPC client");
JsonRpcConnection::Ptr aclient = new JsonRpcConnection(identity, verify_ok, tlsStream, role);
aclient->Start();
@ -392,7 +392,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
} else
AddAnonymousClient(aclient);
} else {
Log(LogInformation, "ApiListener", "New HTTP client");
Log(LogNotice, "ApiListener", "New HTTP client");
HttpServerConnection::Ptr aclient = new HttpServerConnection(identity, verify_ok, tlsStream);
aclient->Start();

View File

@ -115,8 +115,6 @@ bool HttpServerConnection::ProcessMessage(void)
void HttpServerConnection::ProcessMessageAsync(HttpRequest& request)
{
Log(LogInformation, "HttpServerConnection", "Processing Http message");
String auth_header = request.Headers->Get("authorization");
String::SizeType pos = auth_header.FindFirstOf(" ");
@ -145,6 +143,10 @@ void HttpServerConnection::ProcessMessageAsync(HttpRequest& request)
user.reset();
}
Log(LogInformation, "HttpServerConnection")
<< "Request: " << request.RequestMethod << " " << request.RequestUrl->Format()
<< " (" << (user ? user->GetName() : "<unauthenticated>") << ")";
HttpResponse response(m_Stream, request);
if (!user) {