Added variable to log4cxx configs
This commit is contained in:
parent
b8dc29b0a8
commit
803c590d46
4 changed files with 13 additions and 4 deletions
|
@ -1706,6 +1706,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
p.load(istream);
|
||||
p.setProperty("pid", boost::lexical_cast<std::string>(getpid()));
|
||||
p.setProperty("jid", CONFIG_STRING(&config, "service.jid"));
|
||||
log4cxx::PropertyConfigurator::configure(p);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
#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>
|
||||
|
||||
|
@ -218,7 +220,13 @@ int main(int argc, char **argv)
|
|||
#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
|
||||
|
|
Loading…
Add table
Reference in a new issue