Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp?rev=1548398&r1=1548397&r2=1548398&view=diff ============================================================================== --- etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp (original) +++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchDefaultDeliveryService.cpp Fri Dec 6 08:06:01 2013 @@ -22,8 +22,6 @@ #include "support/EtchRuntime.h" #include "util/EtchLogger.h" -static char* TAG = "EtchDefaultDeliveryService"; - const EtchString& EtchDefaultDeliveryService::DISABLE_TIMEOUT() { static const EtchString name("DefaultDeliveryService.disableTimeout"); return name; @@ -95,12 +93,12 @@ status_t EtchDefaultDeliveryService::ses } status_t EtchDefaultDeliveryService::sessionMessage(capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchMessage> msg) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Message will be passed to StubBase to execute the respective remote call"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "Message will be passed to StubBase to execute the respective remote call"); return mSession->sessionMessage(sender, msg); } status_t EtchDefaultDeliveryService::transportMessage(capu::SmartPointer<EtchWho> recipient, capu::SmartPointer<EtchMessage> message) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Result of respective remote call will be passed to Mailbox Manager"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "Result of respective remote call will be passed to Mailbox Manager"); return mTransport->transportMessage(recipient, message); } @@ -144,7 +142,7 @@ status_t EtchDefaultDeliveryService::tra } status_t EtchDefaultDeliveryService::begincall(capu::SmartPointer<EtchMessage> msg, EtchMailbox*& result) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Begin call for the message has been initiated"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "Begin call for the message has been initiated"); return mTransport->transportCall(NULL, msg, result); } @@ -155,20 +153,20 @@ status_t EtchDefaultDeliveryService::end //get message from mailbox EtchMailbox::EtchElement* mbe = NULL; - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "End call for the message starts"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "End call for the message starts"); status_t res = mb->read(mbe, timeout); if (res != ETCH_OK) { mb->closeRead(); - CAPU_LOG_ERROR(mRuntime->getLogger(), TAG, "Error on mailbox read, might be caused by timeout"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "Error on mailbox read, might be caused by timeout"); //TODO: Add error handling return res; } - CAPU_LOG_TRACE(mRuntime->getLogger(), TAG, "We got a message in the mailbox"); + ETCH_LOG_TRACE(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "We got a message in the mailbox"); //get reply message and responseType capu::SmartPointer<EtchMessage> rmsg = mbe->mMsg; if (!rmsg->isType(responseType)) { - CAPU_LOG_ERROR(mRuntime->getLogger(), TAG, "Error on response Type"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "Error on response Type"); mb->closeRead(); rmsg->clear(); delete mbe; @@ -182,12 +180,12 @@ status_t EtchDefaultDeliveryService::end if (err == ETCH_ENOT_EXIST) { //void return value mb->closeRead(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "End call for the message is completed"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "End call for the message is completed"); return ETCH_OK; } else if (err != ETCH_OK) { mb->closeRead(); rmsg->clear(); - CAPU_LOG_ERROR(mRuntime->getLogger(), TAG, "Error on getting respective field on message structure"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "Error on getting respective field on message structure"); delete mbe; return ETCH_ERROR; } @@ -197,7 +195,7 @@ status_t EtchDefaultDeliveryService::end delete mbe; result = r; mb->closeRead(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "End call for the message is completed"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getDeliveryServiceContext(), "End call for the message is completed"); return ETCH_OK; }
Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp?rev=1548398&r1=1548397&r2=1548398&view=diff ============================================================================== --- etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp (original) +++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchMessagizer.cpp Fri Dec 6 08:06:01 2013 @@ -18,8 +18,6 @@ #include "transport/EtchMessagizer.h" #include "support/EtchRuntime.h" -static char* TAG = "EtchMessagizer"; - const EtchString& EtchMessagizer::FORMAT(){ static const EtchString name("Messagizer.format"); return name; @@ -96,10 +94,10 @@ status_t EtchMessagizer::sessionPacket(c capu::SmartPointer<EtchMessage> message; result = mTdi->readMessage(buf, message); if (result != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), TAG, "Deserialization of messages has been failed"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getMessagizerContext(), "Deserialization of messages has been failed"); return result; } - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Message has been deserialized and passed to the Mailbox Manager"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMessagizerContext(), "Message has been deserialized and passed to the Mailbox Manager"); result = mSession->sessionMessage(sender, message); if (result != ETCH_OK) { EtchString errmsg("Unwanted Message"); @@ -129,12 +127,12 @@ status_t EtchMessagizer::transportMessag } result = mTdo->writeMessage(message, msgBuf); if (result != ETCH_OK){ - CAPU_LOG_ERROR(mRuntime->getLogger(), TAG, "Serialization of messages has been failed"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getMessagizerContext(), "Serialization of messages has been failed"); mutex.unlock(); return result; } msgBuf->setIndex(0); - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Serialized message has been sent to the Packetizer"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMessagizerContext(), "Serialized message has been sent to the Packetizer"); result = mTransport->transportPacket(recipient, msgBuf); if (result != ETCH_OK) { mutex.unlock(); Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp?rev=1548398&r1=1548397&r2=1548398&view=diff ============================================================================== --- etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp (original) +++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchPacketizer.cpp Fri Dec 6 08:06:01 2013 @@ -19,8 +19,6 @@ #include "transport/EtchPacketizer.h" #include "support/EtchRuntime.h" -static const char* TAG = "EtchPacketizer"; - const capu::uint32_t& EtchPacketizer::HEADER_SIZE() { static const capu::uint32_t headerSize(8); return headerSize; @@ -131,7 +129,7 @@ status_t EtchPacketizer::transportPacket buf->putInt(EtchPacketizer::SIG()); buf->putInt(pktSize); buf->setIndex(index); - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Header is constructed and raw data has been sent to Transport for transmission"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getPacketizerContext(), "Header is constructed and raw data has been sent to Transport for transmission"); return mTransport->transportData(recipient, buf); } @@ -196,7 +194,7 @@ status_t EtchPacketizer::sessionData(cap capu::uint32_t length = buf->getLength(); capu::uint32_t index = buf->getIndex(); buf->setLength(index + mBodyLen); - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Header is parsed and the body of message is sent to Messagizer"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getPacketizerContext(), "Entire body is in buffer: header is parsed and the body of message is sent to Messagizer"); result = mSession->sessionPacket(sender, buf); if (result != ETCH_OK) { @@ -215,7 +213,7 @@ status_t EtchPacketizer::sessionData(cap mSavedBuf->put(*buf, needFromBuf); mSavedBuf->setIndex(0); - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "Header is parsed and the body of message is sent to Messagizer"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getPacketizerContext(), "more data in buffer: header is parsed and the body of message is sent to Messagizer"); mSession->sessionPacket(sender, mSavedBuf); mSavedBuf->reset(); @@ -239,7 +237,7 @@ status_t EtchPacketizer::processHeader(E buf->getInteger(sig); if (sig != SIG()) { - CAPU_LOG_ERROR(mRuntime->getLogger(), TAG, "SIG is not correct, message will be discarded"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getPacketizerContext(), "SIG is not correct, message will be discarded"); return ETCH_ERROR; } @@ -249,7 +247,7 @@ status_t EtchPacketizer::processHeader(E buf->reset(); if (pktSize > mMaxPktSize) { - CAPU_LOG_ERROR(mRuntime->getLogger(), TAG, "Packet size exceeds the maximum packet size, message will be discarded"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getPacketizerContext(), "Packet size exceeds the maximum packet size, message will be discarded"); return ETCH_ERROR; } return ETCH_OK; Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp?rev=1548398&r1=1548397&r2=1548398&view=diff ============================================================================== --- etch/trunk/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp (original) +++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp Fri Dec 6 08:06:01 2013 @@ -65,7 +65,7 @@ status_t EtchPlainMailboxManager::regist mMailboxes.put(msgid, mb); mMutex.unlock(); - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchPlainMailboxManager", "A new mailbox is registered"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "A new mailbox is registered"); return ETCH_OK; } @@ -87,16 +87,16 @@ status_t EtchPlainMailboxManager::sessio capu::int64_t msgid; if(msg->getInReplyToMessageId(msgid) == ETCH_OK) { EtchMailbox* mb = NULL; - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchPlainMailboxManager", "A message has been received as answer to message identified by %d", msgid); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "A message has been received as answer to message identified by msgid " << msgid); if (getMailbox(msgid, mb) != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchPlainMailboxManager", "Unable to get Mailbox"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Unable to get Mailbox fro msgid " << msgid); return ETCH_ERROR; } - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchPlainMailboxManager", "Message has been sent to respective mailbox"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Message has been sent to respective mailbox"); return mb->message(sender, msg); } // no msgid - pass off to session - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchPlainMailboxManager", "Message has been sent to upper layer directly"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Message has been sent to upper layer directly as no msgid was given"); return mSession->sessionMessage(sender, msg); } @@ -117,15 +117,15 @@ status_t EtchPlainMailboxManager::transp return ETCH_ERROR; } - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchPlainMailboxManager", "A mailbox has been created for message id %d", msgid); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "A mailbox has been created for msgid " << msgid); EtchMailbox *mb = new EtchPlainMailbox(this, msgid); if (registerMailbox(mb) != ETCH_OK) { delete mb; + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Mailbox registration failed"); return ETCH_ERROR; - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchPlainMailboxManager", "Registration has been failed"); } - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchPlainMailboxManager", "Message has been sent to Messagizer with registering a respective mailbox"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Message sending to Messagizer and registering a respective mailbox"); if (mTransport->transportMessage(recipient, msg) == ETCH_OK) { result = mb; return ETCH_OK; @@ -146,7 +146,7 @@ status_t EtchPlainMailboxManager::transp if(message->setMessageId(mIdGen.next()) != ETCH_OK) { return ETCH_ERROR; } - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchPlainMailboxManager", "Message has been sent to Messagizer without registering a mailbox"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Message has been sent to Messagizer without registering a mailbox"); return mTransport->transportMessage(recipient, message); } @@ -175,7 +175,7 @@ status_t EtchPlainMailboxManager::sessio status_t EtchPlainMailboxManager::sessionNotify(capu::SmartPointer<EtchObject> event) { if (event->equals(&EtchSession::UP())) { mUp = true; - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchPlainMailboxManager", "Connection is up"); + ETCH_LOG_TRACE(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Connection is up"); } else if (event->equals(&EtchSession::DOWN())) { mUp = false; // TODO check thread safety @@ -186,7 +186,7 @@ status_t EtchPlainMailboxManager::sessio entry.value->closeDelivery(); delete entry.value; } - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchPlainMailboxManager", "Connection is down"); + ETCH_LOG_TRACE(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "Connection is down"); } status_t status; if(mSession != NULL) { Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp?rev=1548398&r1=1548397&r2=1548398&view=diff ============================================================================== --- etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp (original) +++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp Fri Dec 6 08:06:01 2013 @@ -53,10 +53,10 @@ EtchTcpConnection::~EtchTcpConnection() status_t EtchTcpConnection::send(capu::int8_t* buf, capu::uint32_t off, capu::uint32_t len) { if (mSocket != NULL) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%d byte of data has been transmitted", len); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), len << "byte of data has been transmitted"); return mSocket->send((capu::char_t*)&buf[off], len); } - CAPU_LOG_WARN(mRuntime->getLogger(), "EtchTcpConnection", "%d byte of data has not been transmitted because there is no connection", len); + ETCH_LOG_WARN(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), len << "byte of data has not been transmitted because there is no connection"); return ETCH_ERROR; } @@ -67,17 +67,17 @@ status_t EtchTcpConnection::readSocket() capu::int32_t n; status_t result = mSocket->receive((capu::char_t*)buf->getBuffer(), buf->getSize(), n); if (result != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Receive() failed with error code %d", mHost.c_str(), mPort, result); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Receive() failed with error code " << result); return result; } if (n <= 0) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Connection closed for stack", mHost.c_str(), mPort); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort <<" => Connection closed for stack"); return ETCH_ERROR; } buf->setLength(n); buf->setIndex(0); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => %d byte data has been received and passed to Packetizer", mHost.c_str(), mPort, n); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => " << n << "bytes have been received and passed to Packetizer"); mSession->sessionData(NULL, buf); } return ETCH_OK; @@ -128,7 +128,7 @@ status_t EtchTcpConnection::openSocket(c } if (mSocket->connect((capu::char_t*) mHost.c_str(), mPort) == ETCH_OK) { mMutexConnection.unlock(); - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Connection established", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Connection established"); return ETCH_OK; } else { mSocket->close(); @@ -136,7 +136,7 @@ status_t EtchTcpConnection::openSocket(c mSocket = NULL; first = false; } - CAPU_LOG_WARN(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Connection could not be established for stack %d", mHost.c_str(), mPort); + ETCH_LOG_WARN(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Connection could not be established"); } mMutexConnection.unlock(); @@ -162,14 +162,14 @@ status_t EtchTcpConnection::transportCon mMutex.lock(); if (mIsStarted) { mMutex.unlock(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Start command received and EtchTcpConnection Receiving Thread", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Start command received and EtchTcpConnection Receiving Thread"); return ETCH_OK; } mIsStarted = true; mMutex.unlock(); mThread = new capu::Thread(); mThread->start(*this); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Start command received and EtchTcpConnection Receiving Thread has started", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Start command received and EtchTcpConnection Receiving Thread has started"); return ETCH_OK; } @@ -177,14 +177,14 @@ status_t EtchTcpConnection::transportCon mMutex.lock(); if (mIsStarted) { mMutex.unlock(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Start and wait command received, but already started", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Start and wait command received, but already started"); return ETCH_OK; } mIsStarted = true; mMutex.unlock(); mThread = new capu::Thread(); mThread->start(*this); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Start and wait command received and EtchTcpConnection Receiving Thread has started", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Start and wait command received and EtchTcpConnection Receiving Thread has started"); return waitUp(((EtchInt32*) value.get())->get()); } @@ -192,11 +192,11 @@ status_t EtchTcpConnection::transportCon mMutex.lock(); if (!mIsStarted) { mMutex.unlock(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Stop command received, but already stopped", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Stop command received, but already stopped"); return ETCH_OK; } - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Stop command received and Stop flag for receiving thread is set", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Stop command received and Stop flag for receiving thread is set"); mIsStarted = false; mMutex.unlock(); @@ -208,11 +208,11 @@ status_t EtchTcpConnection::transportCon mMutex.lock(); if (!mIsStarted) { mMutex.unlock(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Stop and wait command received, but already stopped", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Stop and wait command received, but already stopped"); return ETCH_OK; } mIsStarted = false; - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Stop and wait command received and Stop flag for receiving thread is set", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Stop and wait command received and Stop flag for receiving thread is set"); mMutex.unlock(); close(); @@ -223,13 +223,13 @@ status_t EtchTcpConnection::transportCon mMutex.lock(); if (!mIsStarted) { mMutex.unlock(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Reset command received, but no connection established yet", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Reset command received, but no connection established yet"); return ETCH_OK; } mIsStarted = false; mMutex.unlock(); close(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Reset command received and the receiving thread has been restarted", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Reset command received and the receiving thread has been restarted"); return ETCH_OK; } return ETCH_ENOT_SUPPORTED; @@ -245,7 +245,7 @@ void EtchTcpConnection::setSession(EtchS status_t EtchTcpConnection::close() { if (mSocket != NULL) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Socket has been closed", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Socket has been closed"); return mSocket->close(); } else { return ETCH_ERROR; @@ -269,23 +269,23 @@ void EtchTcpConnection::run() { status = openSocket(!first); if (status != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Socket has not been successfully opened", mHost.c_str(), mPort); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Socket has not been successfully opened"); break; } status = setupSocket(); if (status != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Socket has not been successfully opened", mHost.c_str(), mPort); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Socket has not been successfully opened"); close(); break; } - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Socket has been opened and connection has been successfully established and start reading", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Socket has been opened and connection has been successfully established and start reading"); fireUp(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => FireUp was send to the Stack", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => FireUp was send to the Stack"); status = readSocket(); - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Connection closing", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Connection closing"); fireDown(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => FireDown was send to the Stack", mHost.c_str(), mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => FireDown was send to the Stack"); close(); first = false; } @@ -295,22 +295,22 @@ void EtchTcpConnection::run() { status_t EtchTcpConnection::setupSocket() { if (mOptions.getBufferSize() != 0) { if (mSocket->setBufferSize(mOptions.getBufferSize()) != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => setupSocket: Error while setting buffer size", mHost.c_str(), mPort); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => setupSocket: Error while setting buffer size"); return ETCH_ERROR; } } if (mSocket->setKeepAlive((mOptions.getKeepAlive() != 0)) != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => setupSocket: Error while setting keep alive", mHost.c_str(), mPort); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => setupSocket: Error while setting keep alive"); return ETCH_ERROR; } if (mSocket->setLingerOption((mOptions.getLingerTime() >= 0), mOptions.getLingerTime()) != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => setupSocket: Error while setting linger time", mHost.c_str(), mPort); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => setupSocket: Error while setting linger time"); return ETCH_ERROR; } if (mSocket->setNoDelay((mOptions.getNoDelay() != 0)) != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => setupSocket: Error while setting delay", mHost.c_str(), mPort); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => setupSocket: Error while setting delay"); return ETCH_ERROR; } - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Settings for socket has been successfully configured", mHost.c_str(), mPort); + ETCH_LOG_TRACE(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), mHost.c_str() << ":" << mPort << " => Settings for socket has been successfully configured"); return ETCH_OK; } Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp?rev=1548398&r1=1548397&r2=1548398&view=diff ============================================================================== --- etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp (original) +++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp Fri Dec 6 08:06:01 2013 @@ -122,20 +122,21 @@ status_t EtchTcpListener::openSocket(cap } if (mSocket->bind(mPort) == ETCH_OK) { if (mSocket->listen(mBackLog) == ETCH_OK) { + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Listener socket opened successfully on port " << mPort); mMutexConnection.unlock(); return ETCH_OK; } else { mSocket->close(); delete mSocket; mSocket = NULL; - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpListener", "Listening on specified port has failed"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Listening on specified port " << mPort << " has failed"); } } else { delete mSocket; mSocket = NULL; - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpListener", "Binding to specified port has failed"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Binding to specified port " << mPort << " has failed"); } - //LOGGER IS NEEDED + } mMutexConnection.unlock(); return ETCH_ERROR; @@ -148,7 +149,7 @@ status_t EtchTcpListener::readSocket() { if (s == NULL) break; if (mSession != NULL) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "A connection has been accepted"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "A connection has been accepted"); mSession->sessionAccepted(s); } else { delete s; @@ -162,7 +163,7 @@ status_t EtchTcpListener::transportContr if (control->equals(&EtchTcpListener::START())) { if (mIsStarted) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Start command received, but already started - port is %d", mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Ignoring START command received as listener is already started - port is " << mPort); return ETCH_OK; } mMutex.lock(); @@ -173,13 +174,13 @@ status_t EtchTcpListener::transportContr mConnectionChecker = new ConnectionChecker(this); mConnectionCheckerThread = new capu::Thread(); mConnectionCheckerThread->start(*mConnectionChecker); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Start command received and EtchTcpListener starts listening on port %d", mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Start command received and EtchTcpListener starts listening on port " << mPort); return ETCH_OK; } if (control->equals(&EtchTcpListener::START_AND_WAIT_UP())) { if (mIsStarted) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Start and wait up command received, but already started - port is %d", mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Ignoring START_AND_WAIT_UP command received as listener is already started - port is " << mPort); return ETCH_OK; } mMutex.lock(); @@ -190,17 +191,17 @@ status_t EtchTcpListener::transportContr mConnectionChecker = new ConnectionChecker(this); mConnectionCheckerThread = new capu::Thread(); mConnectionCheckerThread->start(*mConnectionChecker); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Start and wait up command received and EtchTcpListener starts listening on port %d", mPort); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Start and wait up command received and EtchTcpListener starts listening on port " << mPort); return waitUp(((EtchInt32*) value.get())->get()); } if (control->equals(&EtchTcpListener::STOP())) { if (!mIsStarted) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Stop command received, but already stopped"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Ignoring STOP command as listener is already stopped"); return ETCH_OK; } mMutex.lock(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Stop command received and EtchTcpListener sets the stop flag"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Stop command received and EtchTcpListener sets the stop flag"); mIsStarted = false; mMutex.unlock(); close(); @@ -209,20 +210,20 @@ status_t EtchTcpListener::transportContr if (control->equals(&EtchTcpListener::STOP_AND_WAIT_DOWN())) { if (!mIsStarted) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Stop and wait command received and EtchTcpListener, but already stopped"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Stop and wait command received and EtchTcpListener, but already stopped"); } mMutex.lock(); mIsStarted = false; mMutex.unlock(); close(); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Stop and wait command received and EtchTcpListener sets the stop flag"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Stop and wait command received and EtchTcpListener sets the stop flag"); status_t ret = waitDown(((EtchInt32*) value.get())->get()); return ret; } if (control->equals(&EtchTcpListener::RESET())) { if (!mIsStarted) { - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Reset command received - but listener is not started yet."); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Reset command received - but listener is not started yet."); return ETCH_OK; } mMutex.lock(); @@ -233,7 +234,7 @@ status_t EtchTcpListener::transportContr mIsStarted = true; mThread = new capu::Thread(); mThread->start(*this); - CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Reset command received and EtchTcpListener has been restarted the stop flag"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Reset command received and EtchTcpListener has been restarted the stop flag"); return ETCH_OK; } return ETCH_ENOT_SUPPORTED; @@ -263,18 +264,18 @@ void EtchTcpListener::run() { while (mIsStarted) { if (openSocket(first) != ETCH_OK) { - CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpListener", "Socket has not been created"); + ETCH_LOG_ERROR(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Socket cannot be opened"); break; } - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchTcpListener", "Socket has been created"); + ETCH_LOG_TRACE(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "Socket has been created"); fireUp(); - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchTcpListener", "FireUp was send to the Stack"); + ETCH_LOG_TRACE(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "FireUp was send to the Stack"); if (readSocket() != ETCH_OK) { close(); break; } fireDown(); - CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchTcpListener", "FireDown was send to the Stack"); + ETCH_LOG_TRACE(mRuntime->getLogger(), mRuntime->getLogger().getTransportContext(), "FireDown was send to the Stack"); close(); first = false; } Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp?rev=1548398&r1=1548397&r2=1548398&view=diff ============================================================================== --- etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp (original) +++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp Fri Dec 6 08:06:01 2013 @@ -19,8 +19,6 @@ #include "support/EtchStackServer.h" #include "transport/EtchTcpTransportFactory.h" -static const char* TAG = "EtchTcpTransportFactory"; - const EtchString& EtchTcpTransportFactory::SOCKET() { static const EtchString name("TcpTransportFactory.socket"); return name; @@ -247,7 +245,7 @@ status_t EtchTcpTransportFactory::MySess delete stack; return status; } - CAPU_LOG_DEBUG(mRuntime->getLogger(), TAG, "New stack for the accepted connection has been created"); + ETCH_LOG_DEBUG(mRuntime->getLogger(), mRuntime->getLogger().getMailboxContext(), "New communication stack for the accepted connection has been created"); return mSession->newServer(mRuntime, m, mUri, res); }
