void IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast<BasicStream&>(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; s << heading; printHeader(s, stream); int batchRequestNum; stream.read(batchRequestNum); s << "\nnumber of requests = " << batchRequestNum; for(int i = 0; i < batchRequestNum; ++i) { s << "\nrequest #" << i << ':'; printRequestHeader(s, stream); stream.skipEncaps(); } logger->trace(tl->protocolCat, s.str()); stream.i = p; } }
void IceInternal::traceRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast<BasicStream&>(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; s << heading; printHeader(s, stream); Int requestId; stream.read(requestId); s << "\nrequest id = " << requestId; if(requestId == 0) { s << " (oneway)"; } printRequestHeader(s, stream); logger->trace(tl->protocolCat, s.str()); stream.i = p; } }
void IceInternal::traceSlicing(const char* kind, const string& typeId, const char* slicingCat, const LoggerPtr& logger) { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(slicingMutex); static set<string> slicingIds; if(slicingIds.insert(typeId).second) { string s("unknown "); s += kind; s += " type `" + typeId + "'"; logger->trace(slicingCat, s); } }
void IceInternal::traceRecv(const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast<BasicStream&>(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; Byte type = printMessage(s, stream); logger->trace(tl->protocolCat, "received " + getMessageTypeAsString(type) + " " + s.str()); stream.i = p; } }
void IceInternal::trace(const char* heading, const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast<BasicStream&>(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; s << heading; printMessage(s, stream); logger->trace(tl->protocolCat, s.str()); stream.i = p; } }
LoggerPtr Logger::getLogger(const string &name) { Loggers::iterator it = loggers.find(name); if (it != loggers.end()) { return it->second; } else { LoggerPtr logger = new Logger(name); if (!logger->isRootLogger()) { LoggerPtr root = Logger::getRootLogger(); logger->setParent(root); logger->setUseParent(true); logger->setLevel(root->getLevel()); } logger->trace("Created logger"); loggers.insert(it, Loggers::value_type(name, logger)); return logger; } }
void CLog4CXX::Trace(const char *loginfo) { m_logger->trace(loginfo); //LOG4CXX_TRACE(m_logger, loginfo); }
void IceInternal::traceReply(const char* heading, const BasicStream& str, const LoggerPtr& logger, const TraceLevelsPtr& tl) { if(tl->protocol >= 1) { BasicStream& stream = const_cast<BasicStream&>(str); BasicStream::Container::iterator p = stream.i; stream.i = stream.b.begin(); ostringstream s; s << heading; printHeader(s, stream); Int requestId; stream.read(requestId); s << "\nrequest id = " << requestId; Byte status; stream.read(status); s << "\nreply status = " << static_cast<int>(status) << ' '; switch(static_cast<DispatchStatus>(status)) { case DispatchOK: { s << "(ok)"; break; } case DispatchUserException: { s << "(user exception)"; break; } case DispatchObjectNotExist: case DispatchFacetNotExist: case DispatchOperationNotExist: { switch(static_cast<DispatchStatus>(status)) { case DispatchObjectNotExist: { s << "(object not exist)"; break; } case DispatchFacetNotExist: { s << "(facet not exist)"; break; } case DispatchOperationNotExist: { s << "(operation not exist)"; break; } default: { assert(false); break; } } printIdentityFacetOperation(s, stream); break; } case DispatchUnknownException: case DispatchUnknownLocalException: case DispatchUnknownUserException: { switch(static_cast<DispatchStatus>(status)) { case DispatchUnknownException: { s << "(unknown exception)"; break; } case DispatchUnknownLocalException: { s << "(unknown local exception)"; break; } case DispatchUnknownUserException: { s << "(unknown user exception)"; break; } default: { assert(false); break; } } string unknown; stream.read(unknown, false); s << "\nunknown = " << unknown; break; } default: { s << "(unknown)"; break; } } logger->trace(tl->protocolCat, s.str()); stream.i = p; } }