Changeset - 803c590d4632
[Not reviewed]
0 4 0
HanzZ - 14 years ago 2011-10-05 09:28:25
hanzz.k@gmail.com
Added variable to log4cxx configs
4 files changed with 13 insertions and 4 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -1703,12 +1703,13 @@ int main(int argc, char **argv) {
 
		else {
 
			log4cxx::helpers::Properties p;
 
			log4cxx::helpers::FileInputStream *istream = new log4cxx::helpers::FileInputStream(CONFIG_STRING(&config, "logging.backend_config"));
 

	
 
			p.load(istream);
 
			p.setProperty("pid", boost::lexical_cast<std::string>(getpid()));
 
			p.setProperty("jid", CONFIG_STRING(&config, "service.jid"));
 
			log4cxx::PropertyConfigurator::configure(p);
 
		}
 

	
 
		initPurple(config);
 

	
 
		SpectrumEventLoop eventLoop;
spectrum/src/backend-logging.cfg
Show inline comments
 
log4j.rootLogger=debug, R
 

	
 
log4j.appender.R=org.apache.log4j.RollingFileAppender
 
log4j.appender.R.File=/var/log/spectrum2/backends/backend-${pid}.log
 
log4j.appender.R.File=/var/log/spectrum2/${jid}/backends/backend-${pid}.log
 

	
 
log4j.appender.R.MaxFileSize=10000KB
 
# Keep one backup file
 
log4j.appender.R.MaxBackupIndex=1
 

	
 
log4j.appender.R.layout=org.apache.log4j.PatternLayout
spectrum/src/logging.cfg
Show inline comments
 
log4j.rootLogger=debug, R
 

	
 
log4j.appender.R=org.apache.log4j.RollingFileAppender
 
log4j.appender.R.File=/var/log/spectrum2/spectrum2.log
 
log4j.appender.R.File=/var/log/spectrum2/${jid}/spectrum2.log
 

	
 
log4j.appender.R.MaxFileSize=10000KB
 
# Keep one backup file
 
log4j.appender.R.MaxBackupIndex=1
 

	
 
log4j.appender.R.layout=org.apache.log4j.PatternLayout
spectrum/src/main.cpp
Show inline comments
 
@@ -17,15 +17,17 @@
 
#include <grp.h>
 
#else
 
#include <Windows.h>
 
#include <tchar.h>
 
#endif
 
#include "log4cxx/logger.h"
 
#include "log4cxx/consoleappender.h"
 
#include "log4cxx/patternlayout.h"
 
#include "log4cxx/propertyconfigurator.h"
 
#include "log4cxx/consoleappender.h"
 
#include "log4cxx/helpers/properties.h"
 
#include "log4cxx/helpers/fileinputstream.h"
 
#include "libgen.h"
 
#include <sys/stat.h>
 
 
using namespace log4cxx;
 
 
using namespace Transport;
 
@@ -215,13 +217,19 @@ int main(int argc, char **argv)
 
		root->addAppender(new ConsoleAppender(new PatternLayout(L"%d %-5p %c: %m%n")));
 
#else
 
		root->addAppender(new ConsoleAppender(new PatternLayout("%d %-5p %c: %m%n")));
 
#endif
 
	}
 
	else {
 
		log4cxx::PropertyConfigurator::configure(CONFIG_STRING(&config, "logging.config"));
 
		log4cxx::helpers::Properties p;
 
		log4cxx::helpers::FileInputStream *istream = new log4cxx::helpers::FileInputStream(CONFIG_STRING(&config, "logging.config"));
 
 
		p.load(istream);
 
		p.setProperty("pid", boost::lexical_cast<std::string>(getpid()));
 
		p.setProperty("jid", CONFIG_STRING(&config, "service.jid"));
 
		log4cxx::PropertyConfigurator::configure(p);
 
	}
 
 
#ifndef WIN32
 
	if (!CONFIG_STRING(&config, "service.group").empty()) {
 
		struct group *gr;
 
		if ((gr = getgrnam(CONFIG_STRING(&config, "service.group").c_str())) == NULL) {
0 comments (0 inline, 0 general)