Apache Log4cxx  Version 2.0.0
Loading...
Searching...
No Matches
loggerrepository.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_SPI_LOG_REPOSITORY_H
19#define _LOG4CXX_SPI_LOG_REPOSITORY_H
20
21#include <log4cxx/appender.h>
23#include <log4cxx/level.h>
25#include <functional>
26
27namespace LOG4CXX_NS
28{
29namespace spi
30{
31
42class LOG4CXX_EXPORT LoggerRepository : public virtual helpers::Object
43{
44 public:
49 virtual ~LoggerRepository();
50
54 virtual void addHierarchyEventListener(const spi::HierarchyEventListenerPtr& listener) = 0;
55
59 virtual void removeHierarchyEventListener(const spi::HierarchyEventListenerPtr& listener) = 0;
60
67 virtual void ensureIsConfigured(std::function<void()> configurator) = 0;
68
74 virtual bool isDisabled(int level) const = 0;
75
81 virtual void setThreshold(const LevelPtr& newLevel) = 0;
82
89 virtual void setThreshold(const LogString& newLevel) = 0;
90
95 virtual void emitNoAppenderWarning(const Logger* logger) = 0;
96
102 virtual LevelPtr getThreshold() const = 0;
103
114 virtual LoggerPtr getLogger(const LogString& name,
115 const spi::LoggerFactoryPtr& factory = {}) = 0;
116
128 virtual bool removeLogger(const LogString& name, bool ifNotUsed = true) = 0;
129
133 virtual LoggerPtr getRootLogger() const = 0;
134
139 virtual LoggerPtr exists(const LogString& name) = 0;
140
145 virtual void shutdown() = 0;
146
153 virtual LoggerList getCurrentLoggers() const = 0;
154
158 virtual void fireAddAppenderEvent(const Logger* logger, const Appender* appender);
159
163 virtual void fireRemoveAppenderEvent(const Logger* logger, const Appender* appender);
164
178 virtual void resetConfiguration() = 0;
179
183 virtual bool isConfigured() = 0;
184
188 virtual void setConfigured(bool configured) = 0;
189
195 virtual void updateChildren(const Logger* parent) = 0;
196}; // class LoggerRepository
197
198} // namespace spi
199} // namespace log4cxx
200
201#endif //_LOG4CXX_SPI_LOG_REPOSITORY_H
Implement this interface for your own strategies for outputting log statements.
Definition appender.h:51
This is the central class in the log4cxx package.
Definition log4cxx/logger.h:52
base class for java-like objects.
Definition object.h:101
A LoggerRepository is used to create and retrieve Loggers.
Definition loggerrepository.h:43
virtual void removeHierarchyEventListener(const spi::HierarchyEventListenerPtr &listener)=0
Implement this to be able to stop notifying listener when an Appender is added or removed from a logg...
virtual void setThreshold(const LevelPtr &newLevel)=0
Enable logging for logging requests with level newLevel or higher.
virtual LoggerPtr getRootLogger() const =0
The logger that cannot be retrieved by name.
virtual LoggerPtr getLogger(const LogString &name, const spi::LoggerFactoryPtr &factory={})=0
Retrieve the name Logger instance.
virtual void updateChildren(const Logger *parent)=0
Refresh the configuration of all loggers where parent is somewhere in their ancestor chain.
virtual bool removeLogger(const LogString &name, bool ifNotUsed=true)=0
Remove the name Logger from the repository.
virtual LoggerList getCurrentLoggers() const =0
All the loggers currently defined in this repository.
virtual void ensureIsConfigured(std::function< void()> configurator)=0
Call configurator if not yet configured and configurator has not already been tried.
virtual void fireAddAppenderEvent(const Logger *logger, const Appender *appender)
Call addAppenderEvent on all registered listeners.
virtual void shutdown()=0
Close and remove all appenders in all categories including the root logger.
virtual void emitNoAppenderWarning(const Logger *logger)=0
Add a warning to internal debug output that logger does not have any Appender attached.
virtual void setConfigured(bool configured)=0
Set the configured status to true.
virtual LoggerPtr exists(const LogString &name)=0
Does name exist in the repository?
virtual void addHierarchyEventListener(const spi::HierarchyEventListenerPtr &listener)=0
Implement this to be able to notify listener when an Appender is added or removed from a logger in th...
virtual bool isConfigured()=0
The value of the configured status.
virtual void resetConfiguration()=0
Reset all values contained in this repository instance to their default.
virtual void fireRemoveAppenderEvent(const Logger *logger, const Appender *appender)
Call removeAppenderEvent on all registered listeners.
virtual bool isDisabled(int level) const =0
Is the repository disabled for level?
virtual LevelPtr getThreshold() const =0
The current repository-wide threshold.
Definition appender.h:30
std::basic_string< logchar > LogString
Definition logstring.h:51
std::shared_ptr< Level > LevelPtr
Definition optionconverter.h:28
std::shared_ptr< Logger > LoggerPtr
Definition provisionnode.h:28
#define LOG4CXX_CAST_ENTRY(Interface)
Definition object.h:153
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition object.h:37
#define END_LOG4CXX_CAST_MAP()
Definition object.h:147
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:141