Coverage Report

Created: 2025-10-10 06:53

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/logging-log4cxx/src/main/cpp/logger.cpp
Line
Count
Source
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
#include <log4cxx/logger.h>
19
#include <log4cxx/spi/loggingevent.h>
20
#include <log4cxx/logmanager.h>
21
#include <log4cxx/appender.h>
22
#include <log4cxx/level.h>
23
#include <log4cxx/hierarchy.h>
24
#include <log4cxx/helpers/stringhelper.h>
25
#include <log4cxx/helpers/transcoder.h>
26
#include <log4cxx/helpers/appenderattachableimpl.h>
27
#include <log4cxx/helpers/exception.h>
28
#if !defined(LOG4CXX)
29
  #define LOG4CXX 1
30
#endif
31
#include <log4cxx/private/log4cxx_private.h>
32
#include <log4cxx/helpers/aprinitializer.h>
33
34
using namespace LOG4CXX_NS;
35
using namespace LOG4CXX_NS::helpers;
36
using namespace LOG4CXX_NS::spi;
37
38
struct Logger::LoggerPrivate
39
{
40
  LoggerPrivate(const LogString& name1)
41
6
    : name(name1)
42
6
    , repositoryRaw(0)
43
6
    , additive(true)
44
6
    , levelData(Level::getData())
45
6
    {}
log4cxx::Logger::LoggerPrivate::LoggerPrivate(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
41
3
    : name(name1)
42
3
    , repositoryRaw(0)
43
3
    , additive(true)
44
3
    , levelData(Level::getData())
45
3
    {}
log4cxx::Logger::LoggerPrivate::LoggerPrivate(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
Line
Count
Source
41
3
    : name(name1)
42
3
    , repositoryRaw(0)
43
3
    , additive(true)
44
3
    , levelData(Level::getData())
45
3
    {}
46
47
  /**
48
  The name of this logger.
49
  */
50
  LogString name;
51
52
  /**
53
  The assigned level of this logger.  The
54
  <code>level</code> variable need not be assigned a value in
55
  which case it is inherited form the hierarchy.  */
56
  LevelPtr level;
57
58
  /**
59
  The parent of this logger. All loggers have at least one
60
  ancestor which is the root logger. */
61
  LoggerPtr parent;
62
63
  /** The resourceBundle for localized messages.
64
65
  @see setResourceBundle, getResourceBundle
66
  */
67
  helpers::ResourceBundlePtr resourceBundle;
68
69
70
  // Loggers need to know what Hierarchy they are in
71
  spi::LoggerRepository* repositoryRaw;
72
73
  helpers::AppenderAttachableImpl aai;
74
75
  /** Additivity is set to true by default, that is children inherit
76
          the appenders of their ancestors by default. If this variable is
77
          set to <code>false</code> then the appenders found in the
78
          ancestors of this logger are not used. However, the children
79
          of this logger will inherit its appenders, unless the children
80
          have their additivity flag set to <code>false</code> too. See
81
          the user manual for more details. */
82
  bool additive;
83
84
  Level::DataPtr levelData;
85
};
86
87
IMPLEMENT_LOG4CXX_OBJECT(Logger)
88
89
Logger::Logger(const LogString& name1)
90
6
  : m_priv(std::make_unique<LoggerPrivate>(name1))
91
6
  , m_threshold(0)
92
6
{
93
6
}
log4cxx::Logger::Logger(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
90
2
  : m_priv(std::make_unique<LoggerPrivate>(name1))
91
2
  , m_threshold(0)
92
2
{
93
2
}
log4cxx::Logger::Logger(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
90
1
  : m_priv(std::make_unique<LoggerPrivate>(name1))
91
1
  , m_threshold(0)
92
1
{
93
1
}
log4cxx::Logger::Logger(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
Line
Count
Source
90
2
  : m_priv(std::make_unique<LoggerPrivate>(name1))
91
2
  , m_threshold(0)
92
2
{
93
2
}
log4cxx::Logger::Logger(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
Line
Count
Source
90
1
  : m_priv(std::make_unique<LoggerPrivate>(name1))
91
1
  , m_threshold(0)
92
1
{
93
1
}
94
95
#if LOG4CXX_ABI_VERSION <= 15
96
Logger::Logger(Pool& p, const LogString& name)
97
0
  : Logger(name)
98
0
{
99
0
}
Unexecuted instantiation: log4cxx::Logger::Logger(log4cxx::helpers::Pool&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: log4cxx::Logger::Logger(log4cxx::helpers::Pool&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: log4cxx::Logger::Logger(log4cxx::helpers::Pool&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
Unexecuted instantiation: log4cxx::Logger::Logger(log4cxx::helpers::Pool&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
100
#endif
101
102
Logger::~Logger()
103
6
{
104
6
}
105
106
void Logger::addAppender(const AppenderPtr newAppender)
107
1.46k
{
108
1.46k
  m_priv->aai.addAppender(newAppender);
109
1.46k
  if (auto rep = getHierarchy())
110
1.46k
  {
111
1.46k
    rep->fireAddAppenderEvent(this, newAppender.get());
112
1.46k
  }
113
1.46k
}
114
115
bool Logger::replaceAppender(const AppenderPtr& oldAppender, const AppenderPtr& newAppender)
116
0
{
117
0
  bool result = m_priv->aai.replaceAppender(oldAppender, newAppender);
118
0
  if (result)
119
0
  {
120
0
    if (auto rep = getHierarchy())
121
0
      rep->fireAddAppenderEvent(this, newAppender.get());
122
0
  }
123
0
  return result;
124
0
}
125
126
void Logger::replaceAppenders( const AppenderList& newList)
127
2
{
128
2
  m_priv->aai.replaceAppenders(newList);
129
130
2
  if (auto rep = getHierarchy())
131
2
  {
132
2
    for (auto const& item : newList)
133
2
      rep->fireAddAppenderEvent(this, item.get());
134
2
  }
135
2
}
136
137
void Logger::reconfigure( const AppenderList& newList, bool newAdditivity )
138
2
{
139
2
  m_priv->additive = newAdditivity;
140
141
2
  replaceAppenders(newList);
142
2
}
143
144
void Logger::callAppenders(const spi::LoggingEventPtr& event, Pool& p) const
145
206k
{
146
206k
  int writes = 0;
147
148
206k
  for (const Logger* logger = this;
149
427k
    logger != 0;
150
221k
    logger = logger->m_priv->parent.get())
151
221k
  {
152
221k
    writes += logger->m_priv->aai.appendLoopOnAppenders(event, p);
153
154
221k
    if (!logger->m_priv->additive)
155
0
    {
156
0
      break;
157
0
    }
158
221k
  }
159
160
206k
  auto rep = getHierarchy();
161
162
206k
  if (writes == 0 && rep)
163
0
  {
164
0
    rep->emitNoAppenderWarning(this);
165
0
  }
166
206k
}
167
168
void Logger::closeNestedAppenders()
169
2.93k
{
170
2.93k
  for (auto& item : getAllAppenders())
171
0
  {
172
0
    item->close();
173
0
  }
174
2.93k
}
175
176
void Logger::addEvent(const LevelPtr& level, helpers::AsyncBuffer&& messageAppender, const LocationInfo& location) const
177
0
{
178
0
  if (!getHierarchy()) // Has removeHierarchy() been called?
179
0
    return;
180
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(messageAppender));
181
0
  Pool p;
182
0
  callAppenders(event, p);
183
0
}
184
185
void Logger::addEvent(const LevelPtr& level, std::string&& message, const LocationInfo& location) const
186
413k
{
187
413k
  if (!getHierarchy()) // Has removeHierarchy() been called?
188
0
    return;
189
#if LOG4CXX_LOGCHAR_IS_UTF8
190
206k
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(message));
191
#else
192
206k
  LOG4CXX_DECODE_CHAR(msg, message);
193
206k
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(msg));
194
206k
#endif
195
206k
  Pool p;
196
206k
  callAppenders(event, p);
197
206k
}
log4cxx::Logger::addEvent(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, log4cxx::spi::LocationInfo const&) const
Line
Count
Source
186
206k
{
187
206k
  if (!getHierarchy()) // Has removeHierarchy() been called?
188
0
    return;
189
206k
#if LOG4CXX_LOGCHAR_IS_UTF8
190
206k
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(message));
191
#else
192
  LOG4CXX_DECODE_CHAR(msg, message);
193
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(msg));
194
#endif
195
206k
  Pool p;
196
206k
  callAppenders(event, p);
197
206k
}
log4cxx::Logger::addEvent(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, log4cxx::spi::LocationInfo const&) const
Line
Count
Source
186
206k
{
187
206k
  if (!getHierarchy()) // Has removeHierarchy() been called?
188
0
    return;
189
#if LOG4CXX_LOGCHAR_IS_UTF8
190
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(message));
191
#else
192
206k
  LOG4CXX_DECODE_CHAR(msg, message);
193
206k
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(msg));
194
206k
#endif
195
206k
  Pool p;
196
206k
  callAppenders(event, p);
197
206k
}
198
199
void Logger::addFatalEvent(std::string&& message, const LocationInfo& location) const
200
0
{
201
0
  addEvent(m_priv->levelData->Fatal, std::move(message), location);
202
0
}
203
204
void Logger::addFatalEvent(helpers::AsyncBuffer&& messageAppender, const LocationInfo& location) const
205
0
{
206
0
  addEvent(m_priv->levelData->Fatal, std::move(messageAppender), location);
207
0
}
208
209
void Logger::addErrorEvent(std::string&& message, const LocationInfo& location) const
210
0
{
211
0
  addEvent(m_priv->levelData->Error, std::move(message), location);
212
0
}
213
214
void Logger::addErrorEvent(helpers::AsyncBuffer&& messageAppender, const LocationInfo& location) const
215
0
{
216
0
  addEvent(m_priv->levelData->Error, std::move(messageAppender), location);
217
0
}
218
219
void Logger::addWarnEvent(std::string&& message, const LocationInfo& location) const
220
0
{
221
0
  addEvent(m_priv->levelData->Warn, std::move(message), location);
222
0
}
223
224
void Logger::addWarnEvent(helpers::AsyncBuffer&& messageAppender, const LocationInfo& location) const
225
0
{
226
0
  addEvent(m_priv->levelData->Warn, std::move(messageAppender), location);
227
0
}
228
229
void Logger::addInfoEvent(std::string&& message, const LocationInfo& location) const
230
191k
{
231
191k
  addEvent(m_priv->levelData->Info, std::move(message), location);
232
191k
}
233
234
void Logger::addInfoEvent(helpers::AsyncBuffer&& messageAppender, const LocationInfo& location) const
235
0
{
236
0
  addEvent(m_priv->levelData->Info, std::move(messageAppender), location);
237
0
}
238
239
void Logger::addDebugEvent(std::string&& message, const LocationInfo& location) const
240
14.6k
{
241
14.6k
  addEvent(m_priv->levelData->Debug, std::move(message), location);
242
14.6k
}
243
244
void Logger::addDebugEvent(helpers::AsyncBuffer&& messageAppender, const LocationInfo& location) const
245
0
{
246
0
  addEvent(m_priv->levelData->Debug, std::move(messageAppender), location);
247
0
}
248
249
void Logger::addTraceEvent(std::string&& message, const LocationInfo& location) const
250
0
{
251
0
  addEvent(m_priv->levelData->Trace, std::move(message), location);
252
0
}
253
254
void Logger::addTraceEvent(helpers::AsyncBuffer&& messageAppender, const LocationInfo& location) const
255
0
{
256
0
  addEvent(m_priv->levelData->Trace, std::move(messageAppender), location);
257
0
}
258
259
void Logger::forcedLog(const LevelPtr& level, const std::string& message,
260
  const LocationInfo& location) const
261
0
{
262
0
  if (!getHierarchy()) // Has removeHierarchy() been called?
263
0
    return;
264
#if LOG4CXX_LOGCHAR_IS_UTF8
265
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, message, location);
266
#else
267
0
  LOG4CXX_DECODE_CHAR(msg, message);
268
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(msg));
269
0
#endif
270
0
  Pool p;
271
0
  callAppenders(event, p);
272
0
}
Unexecuted instantiation: log4cxx::Logger::forcedLog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&) const
Unexecuted instantiation: log4cxx::Logger::forcedLog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&) const
273
274
void Logger::forcedLog(const LevelPtr& level1, const std::string& message) const
275
0
{
276
0
  forcedLog(level1, message, LocationInfo::getLocationUnavailable());
277
0
}
278
279
void Logger::addEventLS(const LevelPtr& level, LogString&& message, const LocationInfo& location) const
280
0
{
281
0
  if (!getHierarchy()) // Has removeHierarchy() been called?
282
0
    return;
283
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(message));
284
0
  Pool p;
285
0
  callAppenders(event, p);
286
0
}
Unexecuted instantiation: log4cxx::Logger::addEventLS(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, log4cxx::spi::LocationInfo const&) const
Unexecuted instantiation: log4cxx::Logger::addEventLS(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&&, log4cxx::spi::LocationInfo const&) const
287
288
void Logger::forcedLogLS(const LevelPtr& level1, const LogString& message,
289
  const LocationInfo& location) const
290
0
{
291
0
  if (!getHierarchy()) // Has removeHierarchy() been called?
292
0
    return;
293
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level1, message, location);
294
0
  Pool p;
295
0
  callAppenders(event, p);
296
0
}
Unexecuted instantiation: log4cxx::Logger::forcedLogLS(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&) const
Unexecuted instantiation: log4cxx::Logger::forcedLogLS(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, log4cxx::spi::LocationInfo const&) const
297
298
299
bool Logger::getAdditivity() const
300
0
{
301
0
  return m_priv->additive;
302
0
}
303
304
AppenderList Logger::getAllAppenders() const
305
2.93k
{
306
2.93k
  return m_priv->aai.getAllAppenders();
307
2.93k
}
308
309
AppenderPtr Logger::getAppender(const LogString& name1) const
310
0
{
311
0
  return m_priv->aai.getAppender(name1);
312
0
}
Unexecuted instantiation: log4cxx::Logger::getAppender(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
Unexecuted instantiation: log4cxx::Logger::getAppender(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) const
313
314
const LevelPtr& Logger::getEffectiveLevel() const
315
14.6k
{
316
29.3k
  for (const Logger* l = this; l != 0; l = l->m_priv->parent.get())
317
29.3k
  {
318
29.3k
    if (l->m_priv->level != 0)
319
14.6k
    {
320
14.6k
      return l->m_priv->level;
321
14.6k
    }
322
29.3k
  }
323
324
0
  throw NullPointerException(LOG4CXX_STR("No level specified for logger or ancestors."));
325
#if LOG4CXX_RETURN_AFTER_THROW
326
  return m_priv->level;
327
#endif
328
14.6k
}
329
330
LoggerRepository* Logger::getLoggerRepository() const
331
0
{
332
0
  return m_priv->repositoryRaw;
333
0
}
334
335
LoggerRepository* Logger::getHierarchy() const
336
625k
{
337
625k
  return m_priv->repositoryRaw;
338
625k
}
339
340
ResourceBundlePtr Logger::getResourceBundle() const
341
0
{
342
0
  for (const Logger* l = this; l != 0; l = l->m_priv->parent.get())
343
0
  {
344
0
    if (l->m_priv->resourceBundle != 0)
345
0
    {
346
0
      return l->m_priv->resourceBundle;
347
0
    }
348
0
  }
349
350
  // It might be the case that there is no resource bundle
351
0
  return 0;
352
0
}
353
354
355
LogString Logger::getResourceBundleString(const LogString& key) const
356
0
{
357
0
  ResourceBundlePtr rb = getResourceBundle();
358
359
  // This is one of the rare cases where we can use logging in order
360
  // to report errors from within log4j.
361
0
  if (rb == 0)
362
0
  {
363
0
    return LogString();
364
0
  }
365
0
  else
366
0
  {
367
0
    try
368
0
    {
369
0
      return rb->getString(key);
370
0
    }
371
0
    catch (MissingResourceException&)
372
0
    {
373
0
      logLS(Level::getError(), LOG4CXX_STR("No resource is associated with key \"") +
374
0
        key + LOG4CXX_STR("\"."), LocationInfo::getLocationUnavailable());
375
376
0
      return LogString();
377
0
    }
378
0
  }
379
0
}
Unexecuted instantiation: log4cxx::Logger::getResourceBundleString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
Unexecuted instantiation: log4cxx::Logger::getResourceBundleString(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) const
380
381
382
LoggerPtr Logger::getParent() const
383
0
{
384
0
  return m_priv->parent;
385
0
}
386
387
const LevelPtr& Logger::getLevel() const
388
191k
{
389
191k
  return m_priv->level;
390
191k
}
391
392
bool Logger::isAttached(const AppenderPtr appender) const
393
0
{
394
0
  return m_priv->aai.isAttached(appender);
395
0
}
396
397
bool Logger::isTraceEnabled() const
398
0
{
399
0
  auto rep = getHierarchy();
400
401
0
  if (!rep || rep->isDisabled(Level::TRACE_INT))
402
0
  {
403
0
    return false;
404
0
  }
405
406
0
  return getEffectiveLevel()->toInt() <= Level::TRACE_INT;
407
0
}
408
409
bool Logger::isDebugEnabled() const
410
14.6k
{
411
14.6k
  auto rep = getHierarchy();
412
413
14.6k
  if (!rep || rep->isDisabled(Level::DEBUG_INT))
414
0
  {
415
0
    return false;
416
0
  }
417
418
14.6k
  return getEffectiveLevel()->toInt() <= Level::DEBUG_INT;
419
14.6k
}
420
421
bool Logger::isEnabledFor(const LevelPtr& level1) const
422
0
{
423
0
  auto rep = getHierarchy();
424
425
0
  if (!rep || rep->isDisabled(level1->toInt()))
426
0
  {
427
0
    return false;
428
0
  }
429
430
0
  return level1->isGreaterOrEqual(getEffectiveLevel());
431
0
}
432
433
434
bool Logger::isInfoEnabled() const
435
191k
{
436
191k
  auto rep = getHierarchy();
437
438
191k
  if (!rep || rep->isDisabled(Level::INFO_INT))
439
0
  {
440
0
    return false;
441
0
  }
442
443
191k
  return getEffectiveLevel()->toInt() <= Level::INFO_INT;
444
191k
}
445
446
bool Logger::isErrorEnabled() const
447
0
{
448
0
  auto rep = getHierarchy();
449
450
0
  if (!rep || rep->isDisabled(Level::ERROR_INT))
451
0
  {
452
0
    return false;
453
0
  }
454
455
0
  return getEffectiveLevel()->toInt() <= Level::ERROR_INT;
456
0
}
457
458
bool Logger::isWarnEnabled() const
459
0
{
460
0
  auto rep = getHierarchy();
461
462
0
  if (!rep || rep->isDisabled(Level::WARN_INT))
463
0
  {
464
0
    return false;
465
0
  }
466
467
0
  return getEffectiveLevel()->toInt() <= Level::WARN_INT;
468
0
}
469
470
bool Logger::isFatalEnabled() const
471
0
{
472
0
  auto rep = getHierarchy();
473
474
0
  if (!rep || rep->isDisabled(Level::FATAL_INT))
475
0
  {
476
0
    return false;
477
0
  }
478
479
0
  return getEffectiveLevel()->toInt() <= Level::FATAL_INT;
480
0
}
481
482
/*void Logger::l7dlog(const LevelPtr& level, const String& key,
483
                        const char* file, int line)
484
{
485
  auto rep = getHierarchy();
486
487
        if (!rep || rep->isDisabled(level->level))
488
        {
489
                return;
490
        }
491
492
        if (level->isGreaterOrEqual(getEffectiveLevel()))
493
        {
494
                String msg = getResourceBundleString(key);
495
496
                // if message corresponding to 'key' could not be found in the
497
                // resource bundle, then default to 'key'.
498
                if (msg.empty())
499
                {
500
                        msg = key;
501
                }
502
503
                forcedLog(FQCN, level, msg, file, line);
504
        }
505
}*/
506
507
508
509
void Logger::l7dlog(const LevelPtr& level1, const LogString& key,
510
  const LocationInfo& location, const std::vector<LogString>& params) const
511
0
{
512
0
  auto rep = getHierarchy();
513
514
0
  if (!rep || rep->isDisabled(level1->toInt()))
515
0
  {
516
0
    return;
517
0
  }
518
519
0
  if (level1->isGreaterOrEqual(getEffectiveLevel()))
520
0
  {
521
0
    LogString pattern = getResourceBundleString(key);
522
0
    LogString msg;
523
524
0
    if (pattern.empty())
525
0
    {
526
0
      msg = key;
527
0
    }
528
0
    else
529
0
    {
530
0
      msg = StringHelper::format(pattern, params);
531
0
    }
532
533
0
    addEventLS(level1, std::move(msg), location);
534
0
  }
535
0
}
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) const
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, log4cxx::spi::LocationInfo const&, std::__1::vector<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >, std::__1::allocator<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > > > const&) const
536
537
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
538
  const LocationInfo& location) const
539
0
{
540
0
  LOG4CXX_DECODE_CHAR(lkey, key);
541
542
0
  std::vector<LogString> values(0);
543
0
  l7dlog(level1, lkey, location, values);
544
0
}
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&) const
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&) const
545
546
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
547
  const LocationInfo& location, const std::string& val1) const
548
0
{
549
0
  LOG4CXX_DECODE_CHAR(lkey, key);
550
0
  LOG4CXX_DECODE_CHAR(lval1, val1);
551
552
0
  std::vector<LogString> values(1);
553
0
  values[0] = lval1;
554
0
  l7dlog(level1, lkey, location, values);
555
0
}
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
556
557
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
558
  const LocationInfo& location,
559
  const std::string& val1, const std::string& val2) const
560
0
{
561
0
  LOG4CXX_DECODE_CHAR(lkey, key);
562
0
  LOG4CXX_DECODE_CHAR(lval1, val1);
563
0
  LOG4CXX_DECODE_CHAR(lval2, val2);
564
565
0
  std::vector<LogString> values(2);
566
0
  values[0] = lval1;
567
0
  values[1] = lval2;
568
0
  l7dlog(level1, lkey, location, values);
569
0
}
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
570
571
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
572
  const LocationInfo& location,
573
  const std::string& val1, const std::string& val2, const std::string& val3) const
574
0
{
575
0
  LOG4CXX_DECODE_CHAR(lkey, key);
576
0
  LOG4CXX_DECODE_CHAR(lval1, val1);
577
0
  LOG4CXX_DECODE_CHAR(lval2, val2);
578
0
  LOG4CXX_DECODE_CHAR(lval3, val3);
579
580
0
  std::vector<LogString> values(3);
581
0
  values[0] = lval1;
582
0
  values[1] = lval2;
583
0
  values[2] = lval3;
584
0
  l7dlog(level1, lkey, location, values);
585
0
}
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
Unexecuted instantiation: log4cxx::Logger::l7dlog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
586
587
void Logger::removeAllAppenders()
588
2.94k
{
589
2.94k
  AppenderList currentAppenders = m_priv->aai.getAllAppenders();
590
2.94k
  m_priv->aai.removeAllAppenders();
591
592
2.94k
  auto rep = getHierarchy();
593
2.94k
  if(rep){
594
2.93k
    for(AppenderPtr appender : currentAppenders){
595
0
      rep->fireRemoveAppenderEvent(this, appender.get());
596
0
    }
597
2.93k
  }
598
2.94k
}
599
600
void Logger::removeAppender(const AppenderPtr appender)
601
1.46k
{
602
1.46k
  m_priv->aai.removeAppender(appender);
603
1.46k
  if (auto rep = getHierarchy())
604
1.46k
  {
605
1.46k
    rep->fireRemoveAppenderEvent(this, appender.get());
606
1.46k
  }
607
1.46k
}
608
609
void Logger::removeAppender(const LogString& name1)
610
0
{
611
0
  AppenderPtr appender = m_priv->aai.getAppender(name1);
612
0
  if(appender){
613
0
    removeAppender(appender);
614
0
  }
615
0
}
Unexecuted instantiation: log4cxx::Logger::removeAppender(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: log4cxx::Logger::removeAppender(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
616
617
void Logger::removeHierarchy()
618
6
{
619
6
  m_priv->repositoryRaw = 0;
620
6
}
621
622
void Logger::setAdditivity(bool additive1)
623
0
{
624
0
  m_priv->additive = additive1;
625
0
}
626
627
void Logger::setHierarchy(spi::LoggerRepository* repository1)
628
6
{
629
6
  m_priv->repositoryRaw = repository1;
630
6
}
631
632
void Logger::setParent(LoggerPtr parentLogger)
633
2
{
634
2
  m_priv->parent = parentLogger;
635
2
  updateThreshold();
636
2
}
637
638
void Logger::setLevel(const LevelPtr level1)
639
6
{
640
6
  if (m_priv->level != level1)
641
6
  {
642
6
    m_priv->level = level1;
643
6
    updateThreshold();
644
6
    if (auto rep = dynamic_cast<Hierarchy*>(getHierarchy()))
645
2
      rep->updateChildren(this);
646
6
  }
647
6
}
648
649
void Logger::updateThreshold()
650
8
{
651
8
  m_threshold = getEffectiveLevel()->toInt();
652
8
}
653
654
const LogString& Logger::getName() const
655
2
{
656
2
  return m_priv->name;
657
2
}
658
659
LoggerPtr Logger::getLogger(const std::string& name)
660
0
{
661
0
  return LogManager::getLogger(name);
662
0
}
663
664
665
LoggerPtr Logger::getLogger(const char* const name)
666
0
{
667
0
  return LogManager::getLogger(name);
668
0
}
669
670
void Logger::setResourceBundle(const helpers::ResourceBundlePtr& bundle)
671
0
{
672
0
  m_priv->resourceBundle = bundle;
673
0
}
674
675
LoggerPtr Logger::getRootLogger()
676
765
{
677
765
  return LogManager::getRootLogger();
678
765
}
679
680
LoggerPtr Logger::getLoggerLS(const LogString& name,
681
  const spi::LoggerFactoryPtr& factory)
682
0
{
683
0
  return LogManager::getLoggerLS(name, factory);
684
0
}
Unexecuted instantiation: log4cxx::Logger::getLoggerLS(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<log4cxx::spi::LoggerFactory> const&)
Unexecuted instantiation: log4cxx::Logger::getLoggerLS(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, std::__1::shared_ptr<log4cxx::spi::LoggerFactory> const&)
685
686
void Logger::getName(std::string& rv) const
687
0
{
688
0
  Transcoder::encode(m_priv->name, rv);
689
0
}
690
691
692
void Logger::trace(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
693
0
{
694
0
  if (isTraceEnabled())
695
0
  {
696
0
    forcedLog(m_priv->levelData->Trace, msg, location);
697
0
  }
698
0
}
699
700
701
void Logger::trace(const std::string& msg) const
702
0
{
703
0
  if (isTraceEnabled())
704
0
  {
705
0
    forcedLog(m_priv->levelData->Trace, msg);
706
0
  }
707
0
}
708
709
void Logger::debug(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
710
0
{
711
0
  if (isDebugEnabled())
712
0
  {
713
0
    forcedLog(m_priv->levelData->Debug, msg, location);
714
0
  }
715
0
}
716
717
void Logger::debug(const std::string& msg) const
718
0
{
719
0
  if (isDebugEnabled())
720
0
  {
721
0
    forcedLog(m_priv->levelData->Debug, msg);
722
0
  }
723
0
}
724
725
726
void Logger::error(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
727
0
{
728
0
  if (isErrorEnabled())
729
0
  {
730
0
    forcedLog(m_priv->levelData->Error, msg, location);
731
0
  }
732
0
}
733
734
735
void Logger::error(const std::string& msg) const
736
0
{
737
0
  if (isErrorEnabled())
738
0
  {
739
0
    forcedLog(m_priv->levelData->Error, msg);
740
0
  }
741
0
}
742
743
void Logger::fatal(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
744
0
{
745
0
  if (isFatalEnabled())
746
0
  {
747
0
    forcedLog(m_priv->levelData->Fatal, msg, location);
748
0
  }
749
0
}
750
751
void Logger::fatal(const std::string& msg) const
752
0
{
753
0
  if (isFatalEnabled())
754
0
  {
755
0
    forcedLog(m_priv->levelData->Fatal, msg);
756
0
  }
757
0
}
758
759
void Logger::info(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
760
0
{
761
0
  if (isInfoEnabled())
762
0
  {
763
0
    forcedLog(m_priv->levelData->Info, msg, location);
764
0
  }
765
0
}
766
767
void Logger::info(const std::string& msg) const
768
0
{
769
0
  if (isInfoEnabled())
770
0
  {
771
0
    forcedLog(m_priv->levelData->Info, msg);
772
0
  }
773
0
}
774
775
void Logger::log(const LevelPtr& level1, const std::string& message,
776
  const LOG4CXX_NS::spi::LocationInfo& location) const
777
0
{
778
0
  if (isEnabledFor(level1))
779
0
  {
780
0
    forcedLog(level1, message, location);
781
0
  }
782
0
}
783
784
void Logger::log(const LevelPtr& level1, const std::string& message) const
785
0
{
786
0
  if (isEnabledFor(level1))
787
0
  {
788
0
    forcedLog(level1, message);
789
0
  }
790
0
}
791
792
void Logger::logLS(const LevelPtr& level1, const LogString& message,
793
  const LOG4CXX_NS::spi::LocationInfo& location) const
794
0
{
795
0
  if (isEnabledFor(level1))
796
0
  {
797
0
    forcedLogLS(level1, message, location);
798
0
  }
799
0
}
Unexecuted instantiation: log4cxx::Logger::logLS(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::LocationInfo const&) const
Unexecuted instantiation: log4cxx::Logger::logLS(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, log4cxx::spi::LocationInfo const&) const
800
801
void Logger::warn(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
802
0
{
803
0
  if (isWarnEnabled())
804
0
  {
805
0
    forcedLog(m_priv->levelData->Warn, msg, location);
806
0
  }
807
0
}
808
809
void Logger::warn(const std::string& msg) const
810
0
{
811
0
  if (isWarnEnabled())
812
0
  {
813
0
    forcedLog(m_priv->levelData->Warn, msg);
814
0
  }
815
0
}
816
817
LoggerPtr Logger::getLoggerLS(const LogString& name)
818
0
{
819
0
  return LogManager::getLoggerLS(name);
820
0
}
Unexecuted instantiation: log4cxx::Logger::getLoggerLS(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: log4cxx::Logger::getLoggerLS(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
821
822
823
824
825
#if LOG4CXX_WCHAR_T_API
826
void Logger::addEvent(const LevelPtr& level, std::wstring&& message, const LocationInfo& location) const
827
0
{
828
0
  if (!getHierarchy()) // Has removeHierarchy() been called?
829
0
    return;
830
#if LOG4CXX_LOGCHAR_IS_WCHAR
831
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(message));
832
#else
833
0
  LOG4CXX_DECODE_WCHAR(msg, message);
834
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(msg));
835
0
#endif
836
0
  Pool p;
837
0
  callAppenders(event, p);
838
0
}
Unexecuted instantiation: log4cxx::Logger::addEvent(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&&, log4cxx::spi::LocationInfo const&) const
Unexecuted instantiation: log4cxx::Logger::addEvent(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&&, log4cxx::spi::LocationInfo const&) const
839
840
void Logger::addFatalEvent(std::wstring&& message, const LocationInfo& location) const
841
0
{
842
0
  addEvent(m_priv->levelData->Fatal, std::move(message), location);
843
0
}
844
845
void Logger::addErrorEvent(std::wstring&& message, const LocationInfo& location) const
846
0
{
847
0
  addEvent(m_priv->levelData->Error, std::move(message), location);
848
0
}
849
850
void Logger::addWarnEvent(std::wstring&& message, const LocationInfo& location) const
851
0
{
852
0
  addEvent(m_priv->levelData->Warn, std::move(message), location);
853
0
}
854
855
void Logger::addInfoEvent(std::wstring&& message, const LocationInfo& location) const
856
0
{
857
0
  addEvent(m_priv->levelData->Info, std::move(message), location);
858
0
}
859
860
void Logger::addDebugEvent(std::wstring&& message, const LocationInfo& location) const
861
0
{
862
0
  addEvent(m_priv->levelData->Debug, std::move(message), location);
863
0
}
864
865
void Logger::addTraceEvent(std::wstring&& message, const LocationInfo& location) const
866
0
{
867
0
  addEvent(m_priv->levelData->Trace, std::move(message), location);
868
0
}
869
870
void Logger::forcedLog(const LevelPtr& level, const std::wstring& message,
871
  const LocationInfo& location) const
872
0
{
873
0
  if (!getHierarchy()) // Has removeHierarchy() been called?
874
0
    return;
875
#if LOG4CXX_LOGCHAR_IS_WCHAR
876
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, message, location);
877
#else
878
0
  LOG4CXX_DECODE_WCHAR(msg, message);
879
0
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(msg));
880
0
#endif
881
0
  Pool p;
882
0
  callAppenders(event, p);
883
0
}
Unexecuted instantiation: log4cxx::Logger::forcedLog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, log4cxx::spi::LocationInfo const&) const
Unexecuted instantiation: log4cxx::Logger::forcedLog(std::__1::shared_ptr<log4cxx::Level> const&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, log4cxx::spi::LocationInfo const&) const
884
885
void Logger::forcedLog(const LevelPtr& level1, const std::wstring& message) const
886
0
{
887
0
  forcedLog(level1, message, LocationInfo::getLocationUnavailable());
888
0
}
889
890
void Logger::getName(std::wstring& rv) const
891
0
{
892
0
  Transcoder::encode(m_priv->name, rv);
893
0
}
894
895
LoggerPtr Logger::getLogger(const std::wstring& name)
896
0
{
897
0
  return LogManager::getLogger(name);
898
0
}
899
900
LoggerPtr Logger::getLogger(const wchar_t* const name)
901
0
{
902
0
  return LogManager::getLogger(name);
903
0
}
904
905
void Logger::trace(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
906
0
{
907
0
  if (isTraceEnabled())
908
0
  {
909
0
    forcedLog(m_priv->levelData->Trace, msg, location);
910
0
  }
911
0
}
912
913
914
void Logger::trace(const std::wstring& msg) const
915
0
{
916
0
  if (isTraceEnabled())
917
0
  {
918
0
    forcedLog(m_priv->levelData->Trace, msg);
919
0
  }
920
0
}
921
922
void Logger::debug(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
923
0
{
924
0
  if (isDebugEnabled())
925
0
  {
926
0
    forcedLog(m_priv->levelData->Debug, msg, location);
927
0
  }
928
0
}
929
930
void Logger::debug(const std::wstring& msg) const
931
0
{
932
0
  if (isDebugEnabled())
933
0
  {
934
0
    forcedLog(m_priv->levelData->Debug, msg);
935
0
  }
936
0
}
937
938
void Logger::error(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
939
0
{
940
0
  if (isErrorEnabled())
941
0
  {
942
0
    forcedLog(m_priv->levelData->Error, msg, location);
943
0
  }
944
0
}
945
946
void Logger::error(const std::wstring& msg) const
947
0
{
948
0
  if (isErrorEnabled())
949
0
  {
950
0
    forcedLog(m_priv->levelData->Error, msg);
951
0
  }
952
0
}
953
954
void Logger::fatal(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
955
0
{
956
0
  if (isFatalEnabled())
957
0
  {
958
0
    forcedLog(m_priv->levelData->Fatal, msg, location);
959
0
  }
960
0
}
961
962
void Logger::fatal(const std::wstring& msg) const
963
0
{
964
0
  if (isFatalEnabled())
965
0
  {
966
0
    forcedLog(m_priv->levelData->Fatal, msg);
967
0
  }
968
0
}
969
970
void Logger::info(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
971
0
{
972
0
  if (isInfoEnabled())
973
0
  {
974
0
    forcedLog(m_priv->levelData->Info, msg, location);
975
0
  }
976
0
}
977
978
void Logger::info(const std::wstring& msg) const
979
0
{
980
0
  if (isInfoEnabled())
981
0
  {
982
0
    forcedLog(m_priv->levelData->Info, msg);
983
0
  }
984
0
}
985
986
void Logger::log(const LevelPtr& level1, const std::wstring& message,
987
  const LOG4CXX_NS::spi::LocationInfo& location) const
988
0
{
989
0
  if (isEnabledFor(level1))
990
0
  {
991
0
    forcedLog(level1, message, location);
992
0
  }
993
0
}
994
995
void Logger::log(const LevelPtr& level1, const std::wstring& message) const
996
0
{
997
0
  if (isEnabledFor(level1))
998
0
  {
999
0
    forcedLog(level1, message);
1000
0
  }
1001
0
}
1002
1003
void Logger::warn(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1004
0
{
1005
0
  if (isWarnEnabled())
1006
0
  {
1007
0
    forcedLog(m_priv->levelData->Warn, msg, location);
1008
0
  }
1009
0
}
1010
1011
void Logger::warn(const std::wstring& msg) const
1012
0
{
1013
0
  if (isWarnEnabled())
1014
0
  {
1015
0
    forcedLog(m_priv->levelData->Warn, msg);
1016
0
  }
1017
0
}
1018
1019
#endif
1020
1021
1022
#if LOG4CXX_UNICHAR_API
1023
void Logger::addEvent(const LevelPtr& level1, std::basic_string<UniChar>&& message, const LocationInfo& location) const
1024
{
1025
  if (!getHierarchy()) // Has removeHierarchy() been called?
1026
    return;
1027
  LOG4CXX_DECODE_UNICHAR(msg, message);
1028
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level1, location, std::move(msg));
1029
  Pool p;
1030
  callAppenders(event, p);
1031
}
1032
1033
void Logger::addFatalEvent(std::basic_string<UniChar>&& message, const LocationInfo& location) const
1034
{
1035
  addEvent(m_priv->levelData->Fatal, std::move(message), location);
1036
}
1037
1038
void Logger::addErrorEvent(std::basic_string<UniChar>&& message, const LocationInfo& location) const
1039
{
1040
  addEvent(m_priv->levelData->Error, std::move(message), location);
1041
}
1042
1043
void Logger::addWarnEvent(std::basic_string<UniChar>&& message, const LocationInfo& location) const
1044
{
1045
  addEvent(m_priv->levelData->Warn, std::move(message), location);
1046
}
1047
1048
void Logger::addInfoEvent(std::basic_string<UniChar>&& message, const LocationInfo& location) const
1049
{
1050
  addEvent(m_priv->levelData->Info, std::move(message), location);
1051
}
1052
1053
void Logger::addDebugEvent(std::basic_string<UniChar>&& message, const LocationInfo& location) const
1054
{
1055
  addEvent(m_priv->levelData->Debug, std::move(message), location);
1056
}
1057
1058
void Logger::addTraceEvent(std::basic_string<UniChar>&& message, const LocationInfo& location) const
1059
{
1060
  addEvent(m_priv->levelData->Trace, std::move(message), location);
1061
}
1062
1063
void Logger::forcedLog(const LevelPtr& level1, const std::basic_string<UniChar>& message,
1064
  const LocationInfo& location) const
1065
{
1066
  if (!getHierarchy()) // Has removeHierarchy() been called?
1067
    return;
1068
  LOG4CXX_DECODE_UNICHAR(msg, message);
1069
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level1, location, std::move(msg));
1070
  Pool p;
1071
  callAppenders(event, p);
1072
}
1073
1074
void Logger::forcedLog(const LevelPtr& level1, const std::basic_string<UniChar>& message) const
1075
{
1076
  if (!getHierarchy()) // Has removeHierarchy() been called?
1077
    return;
1078
  LOG4CXX_DECODE_UNICHAR(msg, message);
1079
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level1, msg,
1080
      LocationInfo::getLocationUnavailable());
1081
  Pool p;
1082
  callAppenders(event, p);
1083
}
1084
1085
void Logger::getName(std::basic_string<UniChar>& rv) const
1086
{
1087
  Transcoder::encode(m_priv->name, rv);
1088
}
1089
1090
LoggerPtr Logger::getLogger(const std::basic_string<UniChar>& name)
1091
{
1092
  return LogManager::getLogger(name);
1093
}
1094
1095
void Logger::trace(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1096
{
1097
  if (isTraceEnabled())
1098
  {
1099
    forcedLog(m_priv->levelData->Trace, msg, location);
1100
  }
1101
}
1102
1103
1104
void Logger::trace(const std::basic_string<UniChar>& msg) const
1105
{
1106
  if (isTraceEnabled())
1107
  {
1108
    forcedLog(m_priv->levelData->Trace, msg);
1109
  }
1110
}
1111
1112
void Logger::debug(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1113
{
1114
  if (isDebugEnabled())
1115
  {
1116
    forcedLog(m_priv->levelData->Debug, msg, location);
1117
  }
1118
}
1119
1120
void Logger::debug(const std::basic_string<UniChar>& msg) const
1121
{
1122
  if (isDebugEnabled())
1123
  {
1124
    forcedLog(m_priv->levelData->Debug, msg);
1125
  }
1126
}
1127
1128
void Logger::error(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1129
{
1130
  if (isErrorEnabled())
1131
  {
1132
    forcedLog(m_priv->levelData->Error, msg, location);
1133
  }
1134
}
1135
1136
void Logger::error(const std::basic_string<UniChar>& msg) const
1137
{
1138
  if (isErrorEnabled())
1139
  {
1140
    forcedLog(m_priv->levelData->Error, msg);
1141
  }
1142
}
1143
1144
void Logger::fatal(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1145
{
1146
  if (isFatalEnabled())
1147
  {
1148
    forcedLog(m_priv->levelData->Fatal, msg, location);
1149
  }
1150
}
1151
1152
void Logger::fatal(const std::basic_string<UniChar>& msg) const
1153
{
1154
  if (isFatalEnabled())
1155
  {
1156
    forcedLog(m_priv->levelData->Fatal, msg);
1157
  }
1158
}
1159
1160
void Logger::info(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1161
{
1162
  if (isInfoEnabled())
1163
  {
1164
    forcedLog(m_priv->levelData->Info, msg, location);
1165
  }
1166
}
1167
1168
void Logger::info(const std::basic_string<UniChar>& msg) const
1169
{
1170
  if (isInfoEnabled())
1171
  {
1172
    forcedLog(m_priv->levelData->Info, msg);
1173
  }
1174
}
1175
1176
void Logger::log(const LevelPtr& level1, const std::basic_string<UniChar>& message,
1177
  const LOG4CXX_NS::spi::LocationInfo& location) const
1178
{
1179
  if (isEnabledFor(level1))
1180
  {
1181
    forcedLog(level1, message, location);
1182
  }
1183
}
1184
1185
void Logger::log(const LevelPtr& level1, const std::basic_string<UniChar>& message) const
1186
{
1187
  if (isEnabledFor(level1))
1188
  {
1189
    forcedLog(level1, message);
1190
  }
1191
}
1192
1193
void Logger::warn(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1194
{
1195
  if (isWarnEnabled())
1196
  {
1197
    forcedLog(m_priv->levelData->Warn, msg, location);
1198
  }
1199
}
1200
1201
void Logger::warn(const std::basic_string<UniChar>& msg) const
1202
{
1203
  if (isWarnEnabled())
1204
  {
1205
    forcedLog(m_priv->levelData->Warn, msg);
1206
  }
1207
}
1208
1209
#endif
1210
1211
1212
#if LOG4CXX_CFSTRING_API
1213
void Logger::forcedLog(const LevelPtr& level, const CFStringRef& message,
1214
  const LocationInfo& location) const
1215
{
1216
  if (!getHierarchy()) // Has removeHierarchy() been called?
1217
    return;
1218
  LOG4CXX_DECODE_CFSTRING(msg, message);
1219
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, location, std::move(msg));
1220
  Pool p;
1221
  callAppenders(event, p);
1222
}
1223
1224
void Logger::forcedLog(const LevelPtr& level, const CFStringRef& message) const
1225
{
1226
  if (!getHierarchy()) // Has removeHierarchy() been called?
1227
    return;
1228
  LOG4CXX_DECODE_CFSTRING(msg, message);
1229
  auto event = std::make_shared<LoggingEvent>(m_priv->name, level, msg,
1230
      LocationInfo::getLocationUnavailable());
1231
  Pool p;
1232
  callAppenders(event, p);
1233
}
1234
1235
void Logger::getName(CFStringRef& rv) const
1236
{
1237
  rv = Transcoder::encode(m_priv->name);
1238
}
1239
1240
LoggerPtr Logger::getLogger(const CFStringRef& name)
1241
{
1242
  return LogManager::getLogger(name);
1243
}
1244
1245
void Logger::trace(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1246
{
1247
  if (isTraceEnabled())
1248
  {
1249
    forcedLog(m_priv->levelData->Trace, msg, location);
1250
  }
1251
}
1252
1253
1254
void Logger::trace(const CFStringRef& msg) const
1255
{
1256
  if (isTraceEnabled())
1257
  {
1258
    forcedLog(m_priv->levelData->Trace, msg);
1259
  }
1260
}
1261
1262
void Logger::debug(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1263
{
1264
  if (isDebugEnabled())
1265
  {
1266
    forcedLog(m_priv->levelData->Debug, msg, location);
1267
  }
1268
}
1269
1270
void Logger::debug(const CFStringRef& msg) const
1271
{
1272
  if (isDebugEnabled())
1273
  {
1274
    forcedLog(m_priv->levelData->Debug, msg);
1275
  }
1276
}
1277
1278
void Logger::error(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1279
{
1280
  if (isErrorEnabled())
1281
  {
1282
    forcedLog(m_priv->levelData->Error, msg, location);
1283
  }
1284
}
1285
1286
void Logger::error(const CFStringRef& msg) const
1287
{
1288
  if (isErrorEnabled())
1289
  {
1290
    forcedLog(m_priv->levelData->Error, msg);
1291
  }
1292
}
1293
1294
void Logger::fatal(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1295
{
1296
  if (isFatalEnabled())
1297
  {
1298
    forcedLog(m_priv->levelData->Fatal, msg, location);
1299
  }
1300
}
1301
1302
void Logger::fatal(const CFStringRef& msg) const
1303
{
1304
  if (isFatalEnabled())
1305
  {
1306
    forcedLog(m_priv->levelData->Fatal, msg);
1307
  }
1308
}
1309
1310
void Logger::info(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1311
{
1312
  if (isInfoEnabled())
1313
  {
1314
    forcedLog(m_priv->levelData->Info, msg, location);
1315
  }
1316
}
1317
1318
void Logger::info(const CFStringRef& msg) const
1319
{
1320
  if (isInfoEnabled())
1321
  {
1322
    forcedLog(m_priv->levelData->Info, msg);
1323
  }
1324
}
1325
1326
void Logger::log(const LevelPtr& level1, const CFStringRef& message,
1327
  const LOG4CXX_NS::spi::LocationInfo& location) const
1328
{
1329
  if (isEnabledFor(level1))
1330
  {
1331
    forcedLog(level1, message, location);
1332
  }
1333
}
1334
1335
void Logger::log(const LevelPtr& level1, const CFStringRef& message) const
1336
{
1337
  if (isEnabledFor(level1))
1338
  {
1339
    forcedLog(level1, message);
1340
  }
1341
}
1342
1343
void Logger::warn(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const
1344
{
1345
  if (isWarnEnabled())
1346
  {
1347
    forcedLog(m_priv->levelData->Warn, msg, location);
1348
  }
1349
}
1350
1351
void Logger::warn(const CFStringRef& msg) const
1352
{
1353
  if (isWarnEnabled())
1354
  {
1355
    forcedLog(m_priv->levelData->Warn, msg);
1356
  }
1357
}
1358
1359
#endif
1360
1361