Commit c0050782 authored by Michael Davis's avatar Michael Davis
Browse files

[cta-frontend] Adds cta.log.level in config file

Default CTA Frontend log level is changed to INFO. To set it back to
debug level, add this line to /etc/cta/cta-frontend-xrootd.conf:

cta.log.level DEBUG

Valid log levels are EMERG, ALERT, CRIT, ERR, WARNING,
parent 442575ff
......@@ -17,13 +17,13 @@
#include "cta_frontend.pb.h"
#include "catalogue/CatalogueFactory.hpp"
#include "common/make_unique.hpp"
#include "common/log/Logger.hpp"
#include "common/log/SyslogLogger.hpp"
#include "common/log/StdoutLogger.hpp"
#include "common/log/FileLogger.hpp"
#include "common/log/LogLevel.hpp"
#include "common/utils/utils.hpp"
#include "catalogue/CatalogueFactory.hpp"
#include "objectstore/BackendVFS.hpp"
#include "rdbms/Login.hpp"
#include "version.h"
......@@ -84,16 +84,22 @@ void XrdSsiCtaServiceProvider::ExceptionThrowingInit(XrdSsiLogger *logP, XrdSsiC
// Instantiate the CTA logging system
try {
// Set the logger URL
auto loggerURL = config.getOptionValueStr("cta.log.url");
if(!loggerURL.first) loggerURL.second = "syslog:";
const auto shortHostname = utils::getShortHostname();
// Set the logger level
int loggerLevel = log::INFO;
auto loggerLevelStr = config.getOptionValueStr("cta.log.level");
if(loggerLevelStr.first) loggerLevel = log::toLogLevel(loggerLevelStr.second);
if (loggerURL.second == "syslog:") {
m_log.reset(new log::SyslogLogger(shortHostname, "cta-frontend", log::DEBUG));
m_log.reset(new log::SyslogLogger(shortHostname, "cta-frontend", loggerLevel));
} else if (loggerURL.second == "stdout:") {
m_log.reset(new log::StdoutLogger(shortHostname, "cta-frontend"));
} else if (loggerURL.second.substr(0, 5) == "file:") {
m_log.reset(new log::FileLogger(shortHostname, "cta-frontend", loggerURL.second.substr(5), log::DEBUG));
m_log.reset(new log::FileLogger(shortHostname, "cta-frontend", loggerURL.second.substr(5), loggerLevel));
} else {
throw exception::Exception(std::string("Unknown log URL: ") + loggerURL.second);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment