Changeset - 27f67d52c81e
[Not reviewed]
0 2 0
Vitaly Takmazov - 13 years ago 2013-02-13 11:53:51
vitalyster@gmail.com
fix msvc compilation with log4cxx
2 files changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/logging.cpp
Show inline comments
 
@@ -138,27 +138,27 @@ static void initLogging(Config *config, std::string key, bool only_create_dir =
 

	
 
		std::vector<std::string> dirs;
 
		BOOST_FOREACH(const log4cxx::LogString &prop, p.propertyNames()) {
 
			if (boost::ends_with(prop, ".File")) {
 
				std::string dir;
 
				log4cxx::helpers::Transcoder::encode(p.get(prop), dir);
 
				boost::replace_all(dir, "${jid}", jid);
 
				boost::replace_all(dir, "${pid}", pid);
 
				boost::replace_all(dir, "${id}", id);
 
				dirs.push_back(dir);
 
			}
 
		}
 
#ifndef WIN32
 
		mode_t old_cmask;
 
		// create directories
 
#ifndef WIN32
 
		old_cmask = umask(0007);
 
#endif
 

	
 
		BOOST_FOREACH(std::string &dir, dirs) {
 
			if (!dir.empty()) {
 
				try {
 
					Transport::Util::createDirectories(config, boost::filesystem::path(dir).parent_path());
 
				}
 
				catch (const boost::filesystem::filesystem_error &e) {
 
					std::cerr << "Can't create logging directory directory " << boost::filesystem::path(dir).parent_path().string() << ": " << e.what() << ".\n";
 
				}
 
			}
src/tests/main.cpp
Show inline comments
 
@@ -10,25 +10,29 @@
 
#include "log4cxx/fileappender.h"
 
#include "log4cxx/patternlayout.h"
 
#include "log4cxx/propertyconfigurator.h"
 

	
 
using namespace log4cxx;
 
#endif
 

	
 

	
 
int main (int argc, char* argv[])
 
{
 
#ifdef WITH_LOG4CXX
 
	LoggerPtr root = Logger::getRootLogger();
 
#ifndef _MSC_VER
 
	root->addAppender(new FileAppender(new PatternLayout("%d %-5p %c: %m%n"), "libtransport_test.log", false));
 
#else
 
	root->addAppender(new FileAppender(new PatternLayout(L"%d %-5p %c: %m%n"), L"libtransport_test.log", false));
 
#endif
 
#endif
 

	
 
	std::vector<std::string> testsToRun;
 
	for (int i = 1; i < argc; ++i) {
 
		std::string param(argv[i]);
 
		testsToRun.push_back(param);
 
	}
 

	
 
	if (testsToRun.empty()) {
 
		testsToRun.push_back("");
 
	}
 

	
0 comments (0 inline, 0 general)