17 #include <boost/lexical_cast.hpp> 18 #include <boost/static_assert.hpp> 19 #include <boost/algorithm/string.hpp> 21 #include <log4cplus/version.h> 22 #include <log4cplus/configurator.h> 23 #include <log4cplus/loggingmacros.h> 53 const char*
const env = getenv(
"KEA_LOCKFILE_DIR");
54 if (env && boost::iequals(
string(env),
string(
"none"))) {
66 LoggerImpl::LoggerImpl(
const string& name) :
86 std::ostringstream ver;
88 ver << log4cplus::versionStr;
95 Level level(severity, dbglevel);
133 return (
new string(
string(ident) +
" " +
144 "NULL was passed to setInterprocessSync()");
161 if (!locker.
lock()) {
162 LOG4CPLUS_ERROR(logger_,
"Unable to lock logger lockfile");
167 LOG4CPLUS_DEBUG(logger_, message);
171 LOG4CPLUS_INFO(logger_, message);
175 LOG4CPLUS_WARN(logger_, message);
179 LOG4CPLUS_ERROR(logger_, message);
183 LOG4CPLUS_FATAL(logger_, message);
190 LOG4CPLUS_ERROR(logger_,
191 "Unsupported severity in LoggerImpl::outputRaw(): " 196 LOG4CPLUS_ERROR(logger_,
"Unable to unlock logger lockfile");
static const MessageDictionaryPtr & globalDictionary()
Return Global Dictionary.
static isc::util::thread::Mutex & getMutex()
Return a process-global mutex that's used for mutual exclusion among threads of a single process duri...
Interprocess Sync Locker Class.
virtual Severity getEffectiveSeverity()
Get Effective Severity Level for Logger.
Severity severity
Logging severity.
static log4cplus::LogLevel convertFromBindLevel(const isc::log::Level &level)
Convert Kea level to log4cplus logging level.
This holds a lock on a Mutex.
std::string * lookupMessage(const MessageID &id)
Look up message text in dictionary.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
virtual ~LoggerImpl()
Destructor.
void setInterprocessSync(isc::log::interprocess::InterprocessSync *sync)
Replace the interprocess synchronization object.
static isc::log::Level convertToBindLevel(const log4cplus::LogLevel loglevel)
Convert log4cplus logging level to Kea logging level.
std::string expandLoggerName(const std::string &name)
Expand logger name.
Defines the logger used by the top-level component of kea-dhcp-ddns.
File-based Interprocess Sync Class.
bool unlock()
Release the lock.
bool lockfileEnabled()
detects whether file locking is enabled or disabled
static std::string getVersion()
Version.
virtual int getDebugLevel()
Return debug level.
virtual void setSeverity(Severity severity, int dbglevel=1)
Set Severity Level for Logger.
void outputRaw(const Severity &severity, const std::string &message)
Raw output.
virtual Severity getSeverity()
Get Severity Level for Logger.
bool lock()
Acquire the lock (blocks if something else has acquired a lock on the same task name)
Null Interprocess Sync Class.
virtual int getEffectiveDebugLevel()
Return effective debug level.