Skip to content

Commit bc0e9dd

Browse files
committed
Remove class DefaultLoggerFactory in the next ABI
1 parent 4232df4 commit bc0e9dd

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

src/main/cpp/defaultloggerfactory.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@
1818
#if LOG4CXX_ABI_VERSION <= 15
1919
#include <log4cxx/defaultloggerfactory.h>
2020
#else
21-
#include <log4cxx/loggerfactory.h>
21+
#include <log4cxx/spi/loggerfactory.h>
2222
#endif
2323

2424
using namespace LOG4CXX_NS;
25-
26-
LoggerPtr spi::LoggerFactory::makeNewLoggerInstance(const LogString& name) const
27-
{
28-
return std::make_shared<Logger>(name);
29-
}
25+
using namespace spi;
3026

3127
#if LOG4CXX_ABI_VERSION <= 15
3228
IMPLEMENT_LOG4CXX_OBJECT(DefaultLoggerFactory)
@@ -38,3 +34,9 @@ LoggerPtr DefaultLoggerFactory::makeNewLoggerInstance(
3834
return std::make_shared<Logger>(name);
3935
}
4036
#endif
37+
38+
LoggerPtr LoggerFactory::makeNewLoggerInstance(const LogString& name) const
39+
{
40+
return std::make_shared<Logger>(name);
41+
}
42+

src/main/cpp/domconfigurator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#if LOG4CXX_ABI_VERSION <= 15
3434
#include <log4cxx/defaultloggerfactory.h>
3535
#else
36-
#include <log4cxx/loggerfactory.h>
36+
#include <log4cxx/spi/loggerfactory.h>
3737
#endif
3838
#include <log4cxx/helpers/filewatchdog.h>
3939
#include <log4cxx/spi/loggerrepository.h>

src/main/cpp/hierarchy.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,11 @@ LevelPtr Hierarchy::getThreshold() const
227227

228228
LoggerPtr Hierarchy::getLogger(const LogString& name)
229229
{
230+
#if LOG4CXX_ABI_VERSION <= 15
230231
static WideLife<spi::LoggerFactoryPtr> defaultFactory = std::make_shared<DefaultLoggerFactory>();
232+
#else
233+
static WideLife<spi::LoggerFactoryPtr> defaultFactory = std::make_shared<LoggerFactory>();
234+
#endif
231235
return getLogger(name, defaultFactory);
232236
}
233237

@@ -246,7 +250,11 @@ LoggerPtr Hierarchy::getLogger(const LogString& name,
246250
}
247251
if (!result && factory)
248252
{
253+
#if LOG4CXX_ABI_VERSION <= 15
254+
LoggerPtr logger(factory->makeNewLoggerInstance(m_priv->pool, name));
255+
#else
249256
LoggerPtr logger(factory->makeNewLoggerInstance(name));
257+
#endif
250258
logger->setHierarchy(this);
251259
m_priv->loggers.insert(LoggerMap::value_type(name, logger));
252260

@@ -283,7 +291,7 @@ LoggerPtr Hierarchy::getRootLogger() const
283291
std::lock_guard<std::recursive_mutex> lock(m_priv->mutex);
284292
if (!m_priv->root)
285293
{
286-
m_priv->root = std::make_shared<RootLogger>(m_priv->pool, Level::getDebug());
294+
m_priv->root = std::make_shared<RootLogger>(Level::getDebug());
287295
m_priv->root->setHierarchy(const_cast<Hierarchy*>(this));
288296
}
289297

src/main/include/log4cxx/spi/loggerfactory.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,20 @@ a sub-class of Logger.
3232
class LOG4CXX_EXPORT LoggerFactory : public virtual helpers::Object
3333
{
3434
public:
35+
#if LOG4CXX_ABI_VERSION <= 15
3536
DECLARE_ABSTRACT_LOG4CXX_OBJECT(LoggerFactory)
37+
#else
38+
DECLARE_LOG4CXX_OBJECT(LoggerFactory)
39+
BEGIN_LOG4CXX_CAST_MAP()
40+
LOG4CXX_CAST_ENTRY(LoggerFactory)
41+
END_LOG4CXX_CAST_MAP()
42+
#endif
3643
virtual ~LoggerFactory() {}
3744

3845
#if LOG4CXX_ABI_VERSION <= 15
3946
LoggerPtr makeNewLoggerInstance(const LogString& name) const;
4047
#else
41-
virtual LoggerPtr makeNewLoggerInstance(const LogString& name) const = 0;
48+
virtual LoggerPtr makeNewLoggerInstance(const LogString& name) const;
4249
#endif
4350

4451
#if LOG4CXX_ABI_VERSION <= 15

0 commit comments

Comments
 (0)