}; // namespace isc::d2
-// Provide an implementation until we figure out a better way to do this.
-void
-dhcp::Daemon::loggerInit(const char* log_name, bool verbose) {
- setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
- setenv("KEA_LOGGER_ROOT", log_name, 0);
- setenv("KEA_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
- setenv("KEA_LOGGER_DBGLEVEL", "99", 0);
- setenv("KEA_LOGGER_DESTINATION", "stdout", 0);
- isc::log::initLogger();
-}
-
}; // namespace isc
std::string
}
}
-void
-Daemon::loggerInit(const char* log_name, bool verbose) {
- isc::log::initLogger(log_name,
- (verbose ? isc::log::DEBUG : isc::log::INFO),
- isc::log::MAX_DEBUG_LEVEL, NULL, true);
-}
-
};
};
// Nothing to do here. No need to disconnect from anything.
}
-/// This is a logger initialization for JSON file backend.
-/// For now, it's just setting log messages to be printed on stdout.
-/// @todo: Implement this properly (see #3427)
-void Daemon::loggerInit(const char* logger_name, bool verbose) {
-
- setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
- setenv("KEA_LOGGER_ROOT", logger_name, 0);
- setenv("KEA_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
- setenv("KEA_LOGGER_DBGLEVEL", "99", 0);
- setenv("KEA_LOGGER_DESTINATION", "stdout", 0);
- isc::log::initLogger();
-}
-
};
};
}
}
-void
-Daemon::loggerInit(const char* log_name, bool verbose) {
- isc::log::initLogger(log_name,
- (verbose ? isc::log::DEBUG : isc::log::INFO),
- isc::log::MAX_DEBUG_LEVEL, NULL, true);
-}
-
}; // end of isc::dhcp namespace
}; // end of isc namespace
// Nothing to do here. No need to disconnect from anything.
}
-/// This is a logger initialization for JSON file backend.
-/// For now, it's just setting log messages to be printed on stdout.
-/// @todo: Implement this properly (see #3427)
-void Daemon::loggerInit(const char* logger_name, bool verbose) {
-
- setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
- setenv("KEA_LOGGER_ROOT", logger_name, 0);
- setenv("KEA_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
- setenv("KEA_LOGGER_DBGLEVEL", "99", 0);
- setenv("KEA_LOGGER_DESTINATION", "stdout", 0);
- isc::log::initLogger();
-}
-
};
};
#include <cc/data.h>
#include <boost/bind.hpp>
#include <logging.h>
+#include <log/logger_name.h>
+#include <log/logger_support.h>
#include <errno.h>
/// @brief provides default implementation for basic daemon operations
parser.applyConfiguration();
}
+void Daemon::loggerInit(const char*, bool verbose) {
+
+ setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 0);
+
+ // Initialize logger system
+ isc::log::initLogger(isc::log::getDefaultRootLoggerName().c_str(),
+ isc::log::DEBUG, isc::log::MAX_DEBUG_LEVEL,
+ NULL);
+
+ // Apply default configuration (log INFO or DEBUG to stdout)
+ LogConfigParser::applyDefaultConfiguration(verbose);
+}
+
};
};
/// @brief Initializes logger
///
- /// This method initializes logger. Currently its implementation is specific
- /// to each configuration backend.
+ /// This method initializes logging system. It also sets the default
+ /// output to stdout. This is used in early stages of the startup
+ /// phase before config file and parsed and proper logging details
+ /// are known.
///
/// @param log_name name used in logger initialization
/// @param verbose verbose mode (true usually enables DEBUG messages)
/// @brief Configures default logging
///
- /// This method is static,
+ /// This method is static, so it can be called in the initial phases of
+ /// the process start-up.
///
/// @param verbose specifies verbose mode (true forces DEBUG, debuglevel = 99)
- void applyDefaultConfiguration(bool verbose = false);
+ static void applyDefaultConfiguration(bool verbose = false);
private: