Commit ef8b3f32 authored by Stephen Morris's avatar Stephen Morris
Browse files

[trac555] Move definition of UnknownLoggingDestination to header file

parent 51f6bda1
......@@ -15,8 +15,18 @@
#ifndef __LOGGER_MANAGER_H
#define __LOGGER_MANAGER_H
#include "exceptions/exceptions.h"
#include <log/logger_specification.h>
// Generated if, when updating the logging specification, an unknown
// destination is encountered.
class UnknownLoggingDestination : public isc::Exception {
public:
UnknownLoggingDestination(const char* file, size_t line, const char* what) :
isc::Exception(file, line, what)
{}
};
namespace isc {
namespace log {
......
......@@ -21,6 +21,7 @@
#include <log4cplus/fileappender.h>
#include "log/logger_level_impl.h"
#include "log/logger_manager.h"
#include "log/logger_manager_impl.h"
#include "log/logger_specification.h"
#include "log/root_logger_name.h"
......@@ -28,18 +29,6 @@
#include "log/logger.h"
#include "log/messagedef.h"
#include "exceptions/exceptions.h"
// Generated exceptions. Methods in this file can't log exceptions as they may
// occur when logging is disabled or in an inconsistent state.
class UnknownLoggingDestination : public isc::Exception {
public:
UnknownLoggingDestination(const char* file, size_t line, const char* what) :
isc::Exception(file, line, what)
{}
};
using namespace std;
namespace isc {
......@@ -63,7 +52,6 @@ LoggerManagerImpl::processInit() {
void
LoggerManagerImpl::processSpecification(const LoggerSpecification& spec) {
// Get/construct the logger for which this specification applies.
log4cplus::Logger logger = (spec.getName() == getRootLoggerName()) ?
log4cplus::Logger::getRoot() :
log4cplus::Logger::getInstance(spec.getName());
......@@ -98,6 +86,10 @@ LoggerManagerImpl::processSpecification(const LoggerSpecification& spec) {
break;
default:
// Not a valid destination. As we are in the middle of updating
// logging destinations, we could be in the situation where
// there are no valid appenders. For this reason, throw an
// exception.
isc_throw(UnknownLoggingDestination,
"Unknown logging destination, code = " <<
i->destination);
......
Markdown is supported
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