Commit 949ef727 authored by Jelte Jansen's avatar Jelte Jansen

Applied second patch from ticket #227 (print module name on stdout/stderr...

Applied second patch from ticket #227 (print module name on stdout/stderr output), reviewed by Jeremy


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2074 e5f2f494-b856-4b98-b285-d166d9295462
parent 60f60716
...@@ -139,7 +139,7 @@ makeErrorMessage(Message& message, MessageRenderer& renderer, ...@@ -139,7 +139,7 @@ makeErrorMessage(Message& message, MessageRenderer& renderer,
message.toWire(renderer); message.toWire(renderer);
if (verbose_mode) { if (verbose_mode) {
cerr << "sending an error response (" << cerr << "[b10-auth] sending an error response (" <<
boost::lexical_cast<string>(renderer.getLength()) boost::lexical_cast<string>(renderer.getLength())
<< " bytes):\n" << message.toText() << endl; << " bytes):\n" << message.toText() << endl;
} }
...@@ -179,7 +179,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message, ...@@ -179,7 +179,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message,
// Ignore all responses. // Ignore all responses.
if (message.getHeaderFlag(MessageFlag::QR())) { if (message.getHeaderFlag(MessageFlag::QR())) {
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "received unexpected response, ignoring" << endl; cerr << "[b10-auth] received unexpected response, ignoring" << endl;
} }
return (false); return (false);
} }
...@@ -192,7 +192,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message, ...@@ -192,7 +192,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message,
message.fromWire(request_buffer); message.fromWire(request_buffer);
} catch (const DNSProtocolError& error) { } catch (const DNSProtocolError& error) {
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "returning " << error.getRcode().toText() << ": " cerr << "[b10-auth] returning " << error.getRcode().toText() << ": "
<< error.what() << endl; << error.what() << endl;
} }
makeErrorMessage(message, response_renderer, error.getRcode(), makeErrorMessage(message, response_renderer, error.getRcode(),
...@@ -200,7 +200,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message, ...@@ -200,7 +200,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message,
return (true); return (true);
} catch (const Exception& ex) { } catch (const Exception& ex) {
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "returning SERVFAIL: " << ex.what() << endl; cerr << "[b10-auth] returning SERVFAIL: " << ex.what() << endl;
} }
makeErrorMessage(message, response_renderer, Rcode::SERVFAIL(), makeErrorMessage(message, response_renderer, Rcode::SERVFAIL(),
impl_->verbose_mode_); impl_->verbose_mode_);
...@@ -208,7 +208,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message, ...@@ -208,7 +208,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message,
} // other exceptions will be handled at a higher layer. } // other exceptions will be handled at a higher layer.
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "[AuthSrv] received a message:\n" << message.toText() << endl; cerr << "[b10-auth] received a message:\n" << message.toText() << endl;
} }
// Perform further protocol-level validation. // Perform further protocol-level validation.
...@@ -216,7 +216,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message, ...@@ -216,7 +216,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message,
// In this implementation, we only support normal queries // In this implementation, we only support normal queries
if (message.getOpcode() != Opcode::QUERY()) { if (message.getOpcode() != Opcode::QUERY()) {
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "unsupported opcode" << endl; cerr << "[b10-auth] unsupported opcode" << endl;
} }
makeErrorMessage(message, response_renderer, Rcode::NOTIMP(), makeErrorMessage(message, response_renderer, Rcode::NOTIMP(),
impl_->verbose_mode_); impl_->verbose_mode_);
...@@ -243,7 +243,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message, ...@@ -243,7 +243,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message,
impl_->data_sources_.doQuery(query); impl_->data_sources_.doQuery(query);
} catch (const Exception& ex) { } catch (const Exception& ex) {
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "Internal error, returning SERVFAIL: " << ex.what() << endl; cerr << "[b10-auth] Internal error, returning SERVFAIL: " << ex.what() << endl;
} }
makeErrorMessage(message, response_renderer, Rcode::SERVFAIL(), makeErrorMessage(message, response_renderer, Rcode::SERVFAIL(),
impl_->verbose_mode_); impl_->verbose_mode_);
...@@ -253,7 +253,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message, ...@@ -253,7 +253,7 @@ AuthSrv::processMessage(InputBuffer& request_buffer, Message& message,
response_renderer.setLengthLimit(udp_buffer ? remote_bufsize : 65535); response_renderer.setLengthLimit(udp_buffer ? remote_bufsize : 65535);
message.toWire(response_renderer); message.toWire(response_renderer);
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "sending a response (" << cerr << "[b10-auth] sending a response (" <<
boost::lexical_cast<string>(response_renderer.getLength()) boost::lexical_cast<string>(response_renderer.getLength())
<< " bytes):\n" << message.toText() << endl; << " bytes):\n" << message.toText() << endl;
} }
...@@ -281,7 +281,7 @@ AuthSrvImpl::setDbFile(const isc::data::ElementPtr config) { ...@@ -281,7 +281,7 @@ AuthSrvImpl::setDbFile(const isc::data::ElementPtr config) {
} }
if (verbose_mode_) { if (verbose_mode_) {
cerr << "[AuthSrv] Data source database file: " << db_file_ << endl; cerr << "[b10-auth] Data source database file: " << db_file_ << endl;
} }
// create SQL data source // create SQL data source
...@@ -313,7 +313,7 @@ AuthSrv::updateConfig(isc::data::ElementPtr new_config) { ...@@ -313,7 +313,7 @@ AuthSrv::updateConfig(isc::data::ElementPtr new_config) {
return answer; return answer;
} catch (const isc::Exception& error) { } catch (const isc::Exception& error) {
if (impl_->verbose_mode_) { if (impl_->verbose_mode_) {
cerr << "[AuthSrv] error: " << error.what() << endl; cerr << "[b10-auth] error: " << error.what() << endl;
} }
return isc::config::createAnswer(1, error.what()); return isc::config::createAnswer(1, error.what());
} }
......
...@@ -157,7 +157,7 @@ main(int argc, char* argv[]) { ...@@ -157,7 +157,7 @@ main(int argc, char* argv[]) {
cout << "[b10-auth] Server started." << endl; cout << "[b10-auth] Server started." << endl;
io_service->run(); io_service->run();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
cerr << ex.what() << endl; cerr << "[b10-auth] " << ex.what() << endl;
ret = 1; ret = 1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment