Merge pull request #100 from vitalyster/manager_logging
Manager logging
This commit is contained in:
commit
d45bd16104
7 changed files with 23 additions and 1 deletions
|
@ -56,6 +56,7 @@ namespace Logging {
|
||||||
|
|
||||||
void initBackendLogging(Config *config);
|
void initBackendLogging(Config *config);
|
||||||
void initMainLogging(Config *config);
|
void initMainLogging(Config *config);
|
||||||
|
void initManagerLogging(Config *config);
|
||||||
void shutdownLogging();
|
void shutdownLogging();
|
||||||
void redirect_stderr();
|
void redirect_stderr();
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,9 @@ void initMainLogging(Config *config) {
|
||||||
initLogging(config, "logging.config");
|
initLogging(config, "logging.config");
|
||||||
initLogging(config, "logging.backend_config", true);
|
initLogging(config, "logging.backend_config", true);
|
||||||
}
|
}
|
||||||
|
void initManagerLogging(Config *config) {
|
||||||
|
initLogging(config, "logging.config");
|
||||||
|
}
|
||||||
|
|
||||||
void redirect_stderr() {
|
void redirect_stderr() {
|
||||||
intercepter_cerr = new intercept_stream(std::cerr, "cerr");
|
intercepter_cerr = new intercept_stream(std::cerr, "cerr");
|
||||||
|
|
|
@ -49,4 +49,8 @@ INSTALL(FILES
|
||||||
DESTINATION /etc/spectrum2
|
DESTINATION /etc/spectrum2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
INSTALL(FILES
|
||||||
|
manager-logging.cfg
|
||||||
|
DESTINATION /etc/spectrum2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
11
spectrum/src/manager-logging.cfg
Normal file
11
spectrum/src/manager-logging.cfg
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
log4j.rootLogger=debug, R
|
||||||
|
|
||||||
|
log4j.appender.R=org.apache.log4j.RollingFileAppender
|
||||||
|
log4j.appender.R.File=/var/log/spectrum2/spectrum_manager.log
|
||||||
|
|
||||||
|
log4j.appender.R.MaxFileSize=10000KB
|
||||||
|
# Keep one backup file
|
||||||
|
log4j.appender.R.MaxBackupIndex=1
|
||||||
|
|
||||||
|
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.R.layout.ConversionPattern=%d %-5p %c: %m%n
|
|
@ -44,6 +44,7 @@ bool ManagerConfig::load(const std::string &configfile, boost::program_options::
|
||||||
("database.password", value<std::string>()->default_value(""), "Database Password.")
|
("database.password", value<std::string>()->default_value(""), "Database Password.")
|
||||||
("database.port", value<int>()->default_value(0), "Database port.")
|
("database.port", value<int>()->default_value(0), "Database port.")
|
||||||
("database.prefix", value<std::string>()->default_value(""), "Prefix of tables in database")
|
("database.prefix", value<std::string>()->default_value(""), "Prefix of tables in database")
|
||||||
|
("logging.config", value<std::string>()->default_value("/etc/spectrum2/manager_logging.cfg"), "Logging configuration file")
|
||||||
;
|
;
|
||||||
|
|
||||||
store(parse_config_file(ifs, opts), m_variables);
|
store(parse_config_file(ifs, opts), m_variables);
|
||||||
|
|
|
@ -106,6 +106,7 @@ Server::Server(ManagerConfig *config, const std::string &config_file) {
|
||||||
m_storageCfg = new Config();
|
m_storageCfg = new Config();
|
||||||
m_storageCfg->load(config_file);
|
m_storageCfg->load(config_file);
|
||||||
|
|
||||||
|
Logging::initManagerLogging(m_storageCfg);
|
||||||
std::string error;
|
std::string error;
|
||||||
m_storage = StorageBackend::createBackend(m_storageCfg, error);
|
m_storage = StorageBackend::createBackend(m_storageCfg, error);
|
||||||
if (m_storage == NULL) {
|
if (m_storage == NULL) {
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "managerconfig.h"
|
#include "managerconfig.h"
|
||||||
|
|
||||||
#include "transport/Config.h"
|
#include "transport/Config.h"
|
||||||
|
#include "transport/Logging.h"
|
||||||
#include "transport/SQLite3Backend.h"
|
#include "transport/SQLite3Backend.h"
|
||||||
#include "transport/MySQLBackend.h"
|
#include "transport/MySQLBackend.h"
|
||||||
#include "transport/PQXXBackend.h"
|
#include "transport/PQXXBackend.h"
|
||||||
|
|
Loading…
Add table
Reference in a new issue