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) if (!listener)
return Empty; return Empty;
String objType = params->Get("type");
String objName = params->Get("name");
if (!listener->GetAcceptConfig()) { if (!listener->GetAcceptConfig()) {
Log(LogWarning, "ApiListener") 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; return Empty;
} }
@ -99,8 +102,6 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
} }
/* update the object */ /* update the object */
String objType = params->Get("type");
String objName = params->Get("name");
int objVersion = Convert::ToLong(params->Get("version")); int objVersion = Convert::ToLong(params->Get("version"));
ConfigType::Ptr dtype = ConfigType::GetByName(objType); ConfigType::Ptr dtype = ConfigType::GetByName(objType);

View File

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

View File

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