I have the following (simplified) code in my C++ program:
std::string DataRequest::toString() const {
LOG4CPLUS_TRACE(logger,
LOG4CPLUS_TEXT("symbol=" << m_contract.symbol));
std::ostringstream oss;
oss << "id=" << reqId
<< ",symbol=" << m_contract.symbol;
return oss.str();
}
and
int DataService::requestData(
DataRequest request) {
LOG4CPLUS_INFO(logger, LOG4CPLUS_TEXT("requestData: " << request.toString()));
}
This code then produces the log message:
TRACE symbol=AAA
INFO symbol=AAArequestData: id=1,symbol=AAA
however I was expecting
TRACE symbol=AAA
INFO requestData: id=1,symbol=AAA
Since there is a log4cplus message being generated within a log4cplus message it appears to be concatenating the two messages into a single message. Is this normal behaviour? Is there a solution to force each message to be generated independently?