[ https://issues.apache.org/jira/browse/GEODE-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15876353#comment-15876353 ]
Jacob S. Barrett commented on GEODE-2499: ----------------------------------------- I would suggest that instead of spending the effort replacing all these lines with std::stringstream that you consider replacing with a more modern logging framework. Most of the places that these strings are used for logging and the effort to build the string is being expended regardless of the disposition of the log message itself. The the example in the description if the LOGDEBUG ultimately does not log then all the overhead of std::stringstream was wasted. A more modern approach would look something like: {noformat} class MyClass { private: Logger logger; void myFunction() { ... if (logger.isDebugEnabled) { log.debug("Some very expensive logging %s.", this->someExpensiveFunction()); } ... log.debug("Something cheap %s." this->somethingCheap); } {noformat} In both these cases the formatting and expensive bits will not execute unless the logger is going to log the message. > Replace snprintf with <sstream> > -------------------------------- > > Key: GEODE-2499 > URL: https://issues.apache.org/jira/browse/GEODE-2499 > Project: Geode > Issue Type: Task > Components: native client > Reporter: Michael Martell > > Using snprintf on Windows has problems. These can be avoided by switching to > newer <sstream> construct as below. This task is to replace snprintf > everywhere in the code (100 or so occurances). > Instead of: > char exMsg[256]; > std::snprintf(exMsg, 255, > "TcrMessageHelper::readChunkPartHeader: " > "%s: part is not object", > methodName); > LOGDEBUG("%s ", exMsg); > use: > std::stringstream s; > s << "TcrMessageHelper::readChunkPartHeader: " << methodName << ": part > is not object\n"; > LOGDEBUG("%s ", s.str().c_str()); -- This message was sent by Atlassian JIRA (v6.3.15#6346)