Apache Log4cxx  Version 1.7.0
log4cxx/logger.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_LOGGER_H
19 #define _LOG4CXX_LOGGER_H
20 
22 #include <log4cxx/level.h>
23 #include <log4cxx/helpers/pool.h>
28 
29 namespace LOG4CXX_NS
30 {
31 
32 namespace spi
33 {
34 class LoggerRepository;
36 class LoggerFactory;
38 }
39 
40 class Logger;
44 
45 
50 class LOG4CXX_EXPORT Logger
51  : public virtual spi::AppenderAttachable
52 {
53  public:
59 
60  private:
61  LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggerPrivate, m_priv)
62  int m_threshold;
63 
64  public:
71  Logger(const LogString& name);
72 #if LOG4CXX_ABI_VERSION <= 15
73  [[ deprecated( "Pool is no longer required" ) ]]
74  Logger(helpers::Pool& pool, const LogString& name);
75 #endif
77 
78 
86  void addAppender(const AppenderPtr newAppender) override;
87 
88 
101  void callAppenders(const spi::LoggingEventPtr& event, helpers::Pool& p) const;
102 
108 
122  void debug(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
137  void debug(const std::string& msg) const;
138 #if LOG4CXX_WCHAR_T_API
154  void debug(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
169  void debug(const std::wstring& msg) const;
170 #endif
171 #if LOG4CXX_UNICHAR_API
187  void debug(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
202  void debug(const std::basic_string<UniChar>& msg) const;
203 #endif
204 #if LOG4CXX_CFSTRING_API
220  void debug(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
235  void debug(const CFStringRef& msg) const;
236 #endif
237 
253  void error(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
268  void error(const std::string& msg) const;
269 #if LOG4CXX_WCHAR_T_API
284  void error(const std::wstring& msg) const;
300  void error(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
301 #endif
302 #if LOG4CXX_UNICHAR_API
318  void error(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
333  void error(const std::basic_string<UniChar>& msg) const;
334 #endif
335 #if LOG4CXX_CFSTRING_API
351  void error(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
366  void error(const CFStringRef& msg) const;
367 #endif
368 
384  void fatal(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
399  void fatal(const std::string& msg) const;
400 #if LOG4CXX_WCHAR_T_API
416  void fatal(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
431  void fatal(const std::wstring& msg) const;
432 #endif
433 #if LOG4CXX_UNICHAR_API
449  void fatal(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
464  void fatal(const std::basic_string<UniChar>& msg) const;
465 #endif
466 #if LOG4CXX_CFSTRING_API
482  void fatal(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
497  void fatal(const CFStringRef& msg) const;
498 #endif
499 
507  void addEvent(const LevelPtr& level, std::string&& message
508  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
509 
517  void addEvent(const LevelPtr& level, helpers::AsyncBuffer&& messageAppender
518  , const spi::LocationInfo& sourceLocation = spi::LocationInfo::getLocationUnavailable()) const;
519 
526  void addFatalEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
527 
534  void addFatalEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
535 
542  void addErrorEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
543 
550  void addErrorEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
551 
558  void addWarnEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
559 
566  void addWarnEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
567 
574  void addInfoEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
575 
582  void addInfoEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
583 
590  void addDebugEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
591 
598  void addDebugEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
599 
606  void addTraceEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
607 
614  void addTraceEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
615 
623  void forcedLog(const LevelPtr& level, const std::string& message,
624  const LOG4CXX_NS::spi::LocationInfo& location) const;
631  void forcedLog(const LevelPtr& level, const std::string& message) const;
632 
633 #if LOG4CXX_WCHAR_T_API
641  void addEvent(const LevelPtr& level, std::wstring&& message
642  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
643 
650  void addFatalEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
651 
658  void addErrorEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
659 
666  void addWarnEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
667 
674  void addInfoEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
675 
682  void addDebugEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
683 
690  void addTraceEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
691 
699  void forcedLog(const LevelPtr& level, const std::wstring& message,
700  const LOG4CXX_NS::spi::LocationInfo& location) const;
707  void forcedLog(const LevelPtr& level, const std::wstring& message) const;
708 #endif
709 #if LOG4CXX_UNICHAR_API
717  void addEvent(const LevelPtr& level, std::basic_string<UniChar>&& message,
718  const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
725  void addFatalEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
732  void addErrorEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
739  void addWarnEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
746  void addInfoEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
753  void addDebugEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
760  void addTraceEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
761 
769  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
770  const LOG4CXX_NS::spi::LocationInfo& location) const;
777  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
778 #endif
779 #if LOG4CXX_CFSTRING_API
787  void forcedLog(const LevelPtr& level, const CFStringRef& message,
788  const LOG4CXX_NS::spi::LocationInfo& location) const;
795  void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
796 #endif
804  void addEventLS(const LevelPtr& level, LogString&& message
805  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
806 
814  void forcedLogLS(const LevelPtr& level, const LogString& message,
815  const LOG4CXX_NS::spi::LocationInfo& location) const;
816 
820  bool getAdditivity() const;
821 
827  AppenderList getAllAppenders() const override;
828 
833  AppenderPtr getAppender(const LogString& name) const override;
834 
844  virtual const LevelPtr& getEffectiveLevel() const;
845 
846 #if LOG4CXX_ABI_VERSION <= 15
852 #endif
853 
858  const LogString& getName() const;
859 
864  void getName(std::string& name) const;
865 #if LOG4CXX_WCHAR_T_API
870  void getName(std::wstring& name) const;
871 #endif
872 #if LOG4CXX_UNICHAR_API
877  void getName(std::basic_string<UniChar>& name) const;
878 #endif
879 #if LOG4CXX_CFSTRING_API
884  void getName(CFStringRef& name) const;
885 #endif
886 
894 
895 
901  const LevelPtr& getLevel() const;
902 
903 #if 15 < LOG4CXX_ABI_VERSION
907  static spi::LoggerRepositoryPtr getLoggerRepository();
908 #endif
909 
914  static LoggerPtr getLogger(const std::string& name);
919  static LoggerPtr getLogger(const char* const name);
920 #if LOG4CXX_WCHAR_T_API
925  static LoggerPtr getLogger(const std::wstring& name);
930  static LoggerPtr getLogger(const wchar_t* const name);
931 #endif
932 #if LOG4CXX_UNICHAR_API
937  static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
938 #endif
939 #if LOG4CXX_CFSTRING_API
944  static LoggerPtr getLogger(const CFStringRef& name);
945 #endif
950  static LoggerPtr getLoggerLS(const LogString& name);
951 
956 
970  static LoggerPtr getLoggerLS(const LogString& name,
971  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
985  static LoggerPtr getLogger(const std::string& name,
986  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
987 #if LOG4CXX_WCHAR_T_API
1001  static LoggerPtr getLogger(const std::wstring& name,
1002  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1003 #endif
1004 #if LOG4CXX_UNICHAR_API
1018  static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
1019  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1020 #endif
1021 #if LOG4CXX_CFSTRING_API
1035  static LoggerPtr getLogger(const CFStringRef& name,
1036  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1037 #endif
1038 
1048  helpers::ResourceBundlePtr getResourceBundle() const;
1049 
1050  protected:
1061 
1062  public:
1078  void info(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1093  void info(const std::string& msg) const;
1094 #if LOG4CXX_WCHAR_T_API
1110  void info(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1125  void info(const std::wstring& msg) const;
1126 #endif
1127 #if LOG4CXX_UNICHAR_API
1141  void info(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1156  void info(const std::basic_string<UniChar>& msg) const;
1157 #endif
1158 #if LOG4CXX_CFSTRING_API
1174  void info(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1189  void info(const CFStringRef& msg) const;
1190 #endif
1191 
1195  bool isAttached(const AppenderPtr appender) const override;
1196 
1231  bool isDebugEnabled() const;
1232 
1254  inline static bool isDebugEnabledFor(const LoggerPtr& logger)
1255  {
1256  return logger && logger->m_threshold <= Level::DEBUG_INT && logger->isDebugEnabled();
1257  }
1258 
1264  bool isEnabledFor(const LevelPtr& level) const;
1265 
1266 
1276  bool isInfoEnabled() const;
1277 
1288  inline static bool isInfoEnabledFor(const LoggerPtr& logger)
1289  {
1290  return logger && logger->m_threshold <= Level::INFO_INT && logger->isInfoEnabled();
1291  }
1292 
1302  bool isWarnEnabled() const;
1303 
1314  inline static bool isWarnEnabledFor(const LoggerPtr& logger)
1315  {
1316  return logger && logger->m_threshold <= Level::WARN_INT && logger->isWarnEnabled();
1317  }
1318 
1328  bool isErrorEnabled() const;
1329 
1340  inline static bool isErrorEnabledFor(const LoggerPtr& logger)
1341  {
1342  return logger && logger->m_threshold <= Level::ERROR_INT && logger->isErrorEnabled();
1343  }
1344 
1354  bool isFatalEnabled() const;
1355 
1366  inline static bool isFatalEnabledFor(const LoggerPtr& logger)
1367  {
1368  return logger && logger->m_threshold <= Level::FATAL_INT && logger->isFatalEnabled();
1369  }
1370 
1380  bool isTraceEnabled() const;
1381 
1392  inline static bool isTraceEnabledFor(const LoggerPtr& logger)
1393  {
1394  return logger && logger->m_threshold <= Level::TRACE_INT && logger->isTraceEnabled();
1395  }
1396 
1415  void l7dlog(const LevelPtr& level, const LogString& key,
1416  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1417  const std::vector<LogString>& values) const;
1433  void l7dlog(const LevelPtr& level, const std::string& key,
1434  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1452  void l7dlog(const LevelPtr& level, const std::string& key,
1453  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1454  const std::string& val) const;
1473  void l7dlog(const LevelPtr& level, const std::string& key,
1474  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1475  const std::string& val1, const std::string& val2) const;
1495  void l7dlog(const LevelPtr& level, const std::string& key,
1496  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1497  const std::string& val1, const std::string& val2, const std::string& val3) const;
1498 
1499 #if LOG4CXX_WCHAR_T_API
1515  void l7dlog(const LevelPtr& level, const std::wstring& key,
1516  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1534  void l7dlog(const LevelPtr& level, const std::wstring& key,
1535  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1536  const std::wstring& val) const;
1555  void l7dlog(const LevelPtr& level, const std::wstring& key,
1556  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1557  const std::wstring& val1, const std::wstring& val2) const;
1577  void l7dlog(const LevelPtr& level, const std::wstring& key,
1578  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1579  const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
1580 #endif
1581 #if LOG4CXX_UNICHAR_API
1597  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1598  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1616  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1617  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1618  const std::basic_string<UniChar>& val) const;
1637  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1638  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1639  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
1659  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1660  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1661  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
1662  const std::basic_string<UniChar>& val3) const;
1663 #endif
1664 #if LOG4CXX_CFSTRING_API
1680  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1681  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1699  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1700  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1701  const CFStringRef& val1) const;
1720  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1721  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1722  const CFStringRef& val1, const CFStringRef& val2) const;
1742  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1743  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1744  const CFStringRef& val1, const CFStringRef& val2,
1745  const CFStringRef& val3) const;
1746 #endif
1747 
1756  void log(const LevelPtr& level, const std::string& message,
1757  const LOG4CXX_NS::spi::LocationInfo& location) const;
1766  void log(const LevelPtr& level, const std::string& message) const;
1767 #if LOG4CXX_WCHAR_T_API
1776  void log(const LevelPtr& level, const std::wstring& message,
1777  const LOG4CXX_NS::spi::LocationInfo& location) const;
1786  void log(const LevelPtr& level, const std::wstring& message) const;
1787 #endif
1788 #if LOG4CXX_UNICHAR_API
1797  void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
1798  const LOG4CXX_NS::spi::LocationInfo& location) const;
1807  void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
1808 #endif
1809 #if LOG4CXX_CFSTRING_API
1818  void log(const LevelPtr& level, const CFStringRef& message,
1819  const LOG4CXX_NS::spi::LocationInfo& location) const;
1828  void log(const LevelPtr& level, const CFStringRef& message) const;
1829 #endif
1838  void logLS(const LevelPtr& level, const LogString& message,
1839  const LOG4CXX_NS::spi::LocationInfo& location) const;
1840 
1841 
1842 
1848  void removeAllAppenders() override;
1849 
1853  void removeAppender(const AppenderPtr appender) override;
1854 
1859  void removeAppender(const LogString& name) override;
1860 
1865  bool replaceAppender(const AppenderPtr& oldAppender, const AppenderPtr& newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER;
1866 
1870  void replaceAppenders(const AppenderList& newList) LOG4CXX_16_VIRTUAL_SPECIFIER;
1871 
1875  void setAdditivity(bool additive);
1876 
1877  protected:
1878  friend class Hierarchy;
1879 
1891  void setParent(LoggerPtr parentLogger);
1896 
1897  public: // Unit testing support methods
1898  void changeParentTo(const LoggerPtr& otherLogger) { setParent(otherLogger); }
1899 
1902  bool isThresholdEqualTo(const LevelPtr& level) const;
1903 
1906  bool isThresholdEqualTo(const LoggerPtr& other) const;
1907 
1910  bool isThresholdValid() const;
1911 
1912  private:
1913  spi::LoggerRepository* getHierarchy() const;
1914 
1915  public:
1922  virtual void setLevel(const LevelPtr level);
1923 
1927  void setResourceBundle(const helpers::ResourceBundlePtr& bundle);
1928 
1929 #if LOG4CXX_WCHAR_T_API
1945  void warn(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1960  void warn(const std::wstring& msg) const;
1961 #endif
1962 #if LOG4CXX_UNICHAR_API
1978  void warn(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1993  void warn(const std::basic_string<UniChar>& msg) const;
1994 #endif
1995 #if LOG4CXX_CFSTRING_API
2011  void warn(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2026  void warn(const CFStringRef& msg) const;
2027 #endif
2043  void warn(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2058  void warn(const std::string& msg) const;
2059 
2060 #if LOG4CXX_WCHAR_T_API
2076  void trace(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2091  void trace(const std::wstring& msg) const;
2092 #endif
2093 #if LOG4CXX_UNICHAR_API
2109  void trace(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2124  void trace(const std::basic_string<UniChar>& msg) const;
2125 #endif
2126 #if LOG4CXX_CFSTRING_API
2142  void trace(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2157  void trace(const CFStringRef& msg) const;
2158 #endif
2174  void trace(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2189  void trace(const std::string& msg) const;
2190 
2198  void reconfigure( const AppenderList& newList, bool newAdditivity );
2199 
2200  private:
2201  //
2202  // prevent copy and assignment
2203  Logger(const Logger&);
2204  Logger& operator=(const Logger&);
2205 };
2207 }
2208 
2209 #if !defined(LOG4CXX_UNLIKELY)
2210  #if __GNUC__ >= 3
2217  #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
2218  #else
2225  #define LOG4CXX_UNLIKELY(expr) expr
2226  #endif
2227 #endif
2228 
2229 #if defined(LOG4CXX_ENABLE_STACKTRACE) && !defined(LOG4CXX_STACKTRACE)
2230  #ifndef __has_include
2231  #include <boost/stacktrace.hpp>
2232  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2233  #elif __has_include(<stacktrace>)
2234  #include <stacktrace>
2235  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + std::stacktrace::to_string(std::stacktrace::stacktrace()));
2236  #elif __has_include(<boost/stacktrace.hpp>)
2237  #include <boost/stacktrace.hpp>
2238  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2239  #else
2240  #warning "Stacktrace requested but no implementation found"
2241  #endif
2242 #endif /* LOG4CXX_ENABLE_STACKTRACE */
2243 
2244 #if !defined(LOG4CXX_STACKTRACE)
2245 #define LOG4CXX_STACKTRACE
2246 #endif
2247 
2248 #ifndef LOG4CXX_FMT_VA_ARG
2249 #if __cplusplus >= 202002L
2250  #define LOG4CXX_FMT_VA_ARG(...) __VA_OPT__(,) __VA_ARGS__
2251 #else
2252  #define LOG4CXX_FMT_VA_ARG(...) , __VA_ARGS__
2253 #endif
2254 #endif
2255 
2267 #define LOG4CXX_LOG(logger, level, message) do { \
2268  if (logger->isEnabledFor(level)) {\
2269  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2270  logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2271 
2280 #define LOG4CXX_LOG_FMT(logger, level, fmt, ...) do { \
2281  if (logger->isEnabledFor(level)) {\
2282  logger->addEvent(level, ::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2283 
2291 #define LOG4CXX_LOGLS(logger, level, message) do { \
2292  if (logger->isEnabledFor(level)) {\
2293  ::LOG4CXX_NS::helpers::LogCharMessageBuffer oss_; \
2294  logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2295 
2296 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000
2316 #define LOG4CXX_DEBUG(logger, message) do { \
2317  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2318  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2319  logger->addDebugEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2320 
2340 #define LOG4CXX_DEBUG_FMT(logger, fmt, ...) do { \
2341  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2342  logger->addDebugEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2343 #else
2344 #define LOG4CXX_DEBUG(logger, message)
2345 #define LOG4CXX_DEBUG_FMT(logger, fmt, ...)
2346 #endif
2347 
2348 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 5000
2360 #define LOG4CXX_TRACE(logger, message) do { \
2361  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2362  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2363  logger->addTraceEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2364 
2377 #define LOG4CXX_TRACE_FMT(logger, fmt, ...) do { \
2378  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2379  logger->addTraceEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2380 #else
2381 #define LOG4CXX_TRACE(logger, message)
2382 #define LOG4CXX_TRACE_FMT(logger, fmt, ...)
2383 #endif
2384 
2385 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 20000
2402 #define LOG4CXX_INFO(logger, message) do { \
2403  if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2404  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2405  logger->addInfoEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2406 
2423 #define LOG4CXX_INFO_FMT(logger, fmt, ...) do { \
2424  if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2425  logger->addInfoEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2426 #else
2427 #define LOG4CXX_INFO(logger, message)
2428 #define LOG4CXX_INFO_FMT(logger, fmt, ...)
2429 #endif
2430 
2431 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 30000
2446 #define LOG4CXX_WARN(logger, message) do { \
2447  if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2448  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2449  logger->addWarnEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2450 
2466 #define LOG4CXX_WARN_FMT(logger, fmt, ...) do { \
2467  if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2468  logger->addWarnEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2469 #else
2470 #define LOG4CXX_WARN(logger, message)
2471 #define LOG4CXX_WARN_FMT(logger, fmt, ...)
2472 #endif
2473 
2474 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 40000
2489 #define LOG4CXX_ERROR(logger, message) do { \
2490  if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2491  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2492  logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2493 
2509 #define LOG4CXX_ERROR_FMT(logger, fmt, ...) do { \
2510  if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2511  logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2512 
2520 #define LOG4CXX_ASSERT(logger, condition, message) do { \
2521  if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2522  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2523  LOG4CXX_STACKTRACE \
2524  logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2525 
2536 #define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...) do { \
2537  if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2538  LOG4CXX_STACKTRACE \
2539  logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2540 
2541 #else
2542 #define LOG4CXX_ERROR(logger, message)
2543 #define LOG4CXX_ERROR_FMT(logger, fmt, ...)
2544 #define LOG4CXX_ASSERT(logger, condition, message)
2545 #define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...)
2546 #endif
2547 
2548 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 50000
2560 #define LOG4CXX_FATAL(logger, message) do { \
2561  if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2562  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2563  logger->addFatalEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2564 
2577 #define LOG4CXX_FATAL_FMT(logger, fmt, ...) do { \
2578  if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2579  logger->addFatalEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2580 #else
2581 #define LOG4CXX_FATAL(logger, message)
2582 #define LOG4CXX_FATAL_FMT(logger, fmt, ...)
2583 #endif
2584 
2592 #define LOG4CXX_L7DLOG(logger, level, key) do { \
2593  if (logger->isEnabledFor(level)) {\
2594  logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
2595 
2604 #define LOG4CXX_L7DLOG1(logger, level, key, p1) do { \
2605  if (logger->isEnabledFor(level)) {\
2606  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
2607 
2617 #define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) do { \
2618  if (logger->isEnabledFor(level)) {\
2619  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
2620 
2631 #define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) do { \
2632  if (logger->isEnabledFor(level)) {\
2633  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
2634 
2638 
2639 #endif //_LOG4CXX_LOGGER_H
This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy.
Definition: hierarchy.h:52
This is the central class in the log4cxx package.
Definition: log4cxx/logger.h:52
void log(const LevelPtr &level, const std::wstring &message) const
Add a new logging event containing message to the appenders attached to this logger if this logger is...
static LoggerPtr getLogger(const std::basic_string< UniChar > &name)
Retrieve a logger by name.
void info(const std::string &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
const LogString & getName() const
Get the logger name.
void setAdditivity(bool additive)
Set the additivity flag for this logger.
void info(const std::wstring &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
void addWarnEvent(std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new warning level logging event containing message and location to attached appender(s) without...
void addDebugEvent(std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new debug level logging event containing message and location to attached appender(s) without f...
void removeAllAppenders() override
Remove all previously added appenders from this logger instance.
static LoggerPtr getLogger(const std::string &name, const log4cxx::spi::LoggerFactoryPtr &factory)
Like getLogger except that the type of logger instantiated depends on the type returned by the Logger...
void warn(const std::wstring &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
void l7dlog(const LevelPtr &level, const std::string &key, const log4cxx::spi::LocationInfo &locationInfo, const std::string &val1, const std::string &val2, const std::string &val3) const
Add a new logging event containing locationInfo and the localized message key using parameters val1,...
void info(const std::basic_string< UniChar > &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
static LoggerPtr getLogger(const std::basic_string< UniChar > &name, const log4cxx::spi::LoggerFactoryPtr &factory)
Like getLogger except that the type of logger instantiated depends on the type returned by the Logger...
void setParent(LoggerPtr parentLogger)
Only the Hierarchy class can set the parent of a logger.
static bool isErrorEnabledFor(const LoggerPtr &logger)
Is logger is enabled for ERROR level logging events?
Definition: log4cxx/logger.h:1340
void addDebugEvent(helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new DEBUG level LoggingEvent which was requested at sourceLocation wher...
void log(const LevelPtr &level, const std::basic_string< UniChar > &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to the appenders attached to this logger if t...
void error(const std::basic_string< UniChar > &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void warn(const std::basic_string< UniChar > &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
static LoggerPtr getLoggerLS(const LogString &name, const log4cxx::spi::LoggerFactoryPtr &factory)
Like getLogger except that the type of logger instantiated depends on the type returned by the Logger...
void debug(const CFStringRef &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for DEBUG ev...
static LoggerPtr getLoggerLS(const LogString &name)
Retrieve a logger by name in Unicode.
void setResourceBundle(const helpers::ResourceBundlePtr &bundle)
Set the resource bundle to be used with localized logging methods.
AppenderList getAllAppenders() const override
Get the appenders contained in this logger as an AppenderList.
Logger(helpers::Pool &pool, const LogString &name)
void addEvent(const LevelPtr &level, std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new logging event containing message and location to attached appender(s) without further check...
void warn(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
void error(const std::wstring &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for ERROR ev...
void addWarnEvent(std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new warning level logging event containing message and location to attached appender(s) without...
void l7dlog(const LevelPtr &level, const std::basic_string< UniChar > &key, const log4cxx::spi::LocationInfo &locationInfo, const std::basic_string< UniChar > &val1, const std::basic_string< UniChar > &val2, const std::basic_string< UniChar > &val3) const
Add a new logging event containing locationInfo and the localized message key using parameters val1,...
void trace(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
static LoggerPtr getLogger(const std::wstring &name)
Retrieve a logger by name.
helpers::ResourceBundlePtr getResourceBundle() const
Return the inherited ResourceBundle for this logger.
void fatal(const std::wstring &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
bool isThresholdEqualTo(const LoggerPtr &other) const
Is m_threshold the same as other.
void addWarnEvent(std::basic_string< UniChar > &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new warning level logging event containing message and location to attached appender(s) without...
void logLS(const LevelPtr &level, const LogString &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to the appenders attached to this logger if t...
static LoggerPtr getLogger(const char *const name)
Retrieve a logger by name in current encoding.
bool isInfoEnabled() const
Is this logger is enabled for INFO level logging events?
void trace(const std::string &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
void addInfoEvent(std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new info level logging event containing message and location to attached appender(s) without fu...
bool isAttached(const AppenderPtr appender) const override
Is appender attached to this logger?
bool isFatalEnabled() const
Is this logger is enabled for FATAL level logging events?
void debug(const std::basic_string< UniChar > &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for DEBUG ev...
void warn(const CFStringRef &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
void log(const LevelPtr &level, const CFStringRef &message) const
Add a new logging event containing message to the appenders attached to this logger if this logger is...
virtual void setLevel(const LevelPtr level)
Set the level of this logger.
void getName(std::wstring &name) const
Put name of this logger into name.
void addTraceEvent(std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new trace level logging event containing message and location to attached appender(s) without f...
bool isWarnEnabled() const
Is this logger is enabled for WARN level logging events?
void l7dlog(const LevelPtr &level, const std::wstring &key, const log4cxx::spi::LocationInfo &locationInfo, const std::wstring &val) const
Add a new logging event containing locationInfo and the localized message key using parameter val to ...
void removeAppender(const LogString &name) override
Remove the appender with the name passed as parameter form the list of appenders.
void debug(const std::basic_string< UniChar > &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
spi::LoggerRepository * getLoggerRepository() const
Return the the LoggerRepository where this Logger is attached.
void fatal(const CFStringRef &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for FATAL ev...
void log(const LevelPtr &level, const std::basic_string< UniChar > &message) const
Add a new logging event containing message to the appenders attached to this logger if this logger is...
void l7dlog(const LevelPtr &level, const std::basic_string< UniChar > &key, const log4cxx::spi::LocationInfo &locationInfo, const std::basic_string< UniChar > &val1, const std::basic_string< UniChar > &val2) const
Add a new logging event containing locationInfo and the localized message key using parameters val1 a...
void addEvent(const LevelPtr &level, helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &sourceLocation=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new level LoggingEvent which was requested at sourceLocation where the ...
const LevelPtr & getLevel() const
The assigned Level, if any, for this logger.
void addEventLS(const LevelPtr &level, LogString &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new logging event containing message and location to attached appender(s) without further check...
void log(const LevelPtr &level, const std::string &message) const
Add a new logging event containing message to the appenders attached to this logger if this logger is...
void trace(const std::basic_string< UniChar > &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
void l7dlog(const LevelPtr &level, const CFStringRef &key, const log4cxx::spi::LocationInfo &locationInfo) const
Add a new logging event containing locationInfo and the localized message key to attached appender(s)...
void trace(const std::wstring &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
void error(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for ERROR ev...
void l7dlog(const LevelPtr &level, const CFStringRef &key, const log4cxx::spi::LocationInfo &locationInfo, const CFStringRef &val1, const CFStringRef &val2) const
Add a new logging event containing locationInfo and the localized message key using parameters val1 a...
void addEvent(const LevelPtr &level, std::basic_string< UniChar > &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new logging event containing message and location to attached appender(s) without further check...
void fatal(const std::wstring &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for FATAL ev...
static LoggerPtr getLogger(const CFStringRef &name, const log4cxx::spi::LoggerFactoryPtr &factory)
Like getLogger except that the type of logger instantiated depends on the type returned by the Logger...
LogString getResourceBundleString(const LogString &key) const
Returns the string resource corresponding to key in this logger's inherited resource bundle.
bool isEnabledFor(const LevelPtr &level) const
Is this logger is enabled for logging events at level?
static LoggerPtr getLogger(const wchar_t *const name)
Retrieve a logger by name.
void debug(const std::string &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void addFatalEvent(std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new fatal level logging event containing message and location to attached appender(s) without f...
void debug(const CFStringRef &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void info(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
void forcedLog(const LevelPtr &level, const std::basic_string< UniChar > &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to attached appender(s) without further check...
void forcedLog(const LevelPtr &level, const std::basic_string< UniChar > &message) const
Add a new logging event containing message to attached appender(s) without further checks.
static bool isWarnEnabledFor(const LoggerPtr &logger)
Is logger is enabled for WARN level logging events?
Definition: log4cxx/logger.h:1314
void error(const CFStringRef &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for ERROR ev...
bool isThresholdEqualTo(const LevelPtr &level) const
Is m_threshold the same as level->toInt()
void addEvent(const LevelPtr &level, std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new logging event containing message and location to attached appender(s) without further check...
void error(const std::wstring &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void warn(const std::string &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
void replaceAppenders(const AppenderList &newList) LOG4CXX_16_VIRTUAL_SPECIFIER
Replace all previously added appenders with newList.
void l7dlog(const LevelPtr &level, const std::string &key, const log4cxx::spi::LocationInfo &locationInfo, const std::string &val) const
Add a new logging event containing locationInfo and the localized message key using parameter val to ...
void warn(const CFStringRef &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
void addFatalEvent(helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new FATAL level LoggingEvent which was requested at sourceLocation wher...
void addFatalEvent(std::basic_string< UniChar > &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new fatal level logging event containing message and location to attached appender(s) without f...
void forcedLog(const LevelPtr &level, const CFStringRef &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to attached appender(s) without further check...
void forcedLog(const LevelPtr &level, const CFStringRef &message) const
Add a new logging event containing message to attached appender(s) without further checks.
void addInfoEvent(std::basic_string< UniChar > &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new info level logging event containing message and location to attached appender(s) without fu...
void fatal(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for FATAL ev...
void log(const LevelPtr &level, const std::wstring &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to the appenders attached to this logger if t...
void addErrorEvent(std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new error level logging event containing message and location to attached appender(s) without f...
static bool isDebugEnabledFor(const LoggerPtr &logger)
Is logger is enabled for DEBUG level logging events?
Definition: log4cxx/logger.h:1254
void warn(const std::wstring &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
AppenderPtr getAppender(const LogString &name) const override
Look for the appender named as name.
void setHierarchy(spi::LoggerRepository *repository)
Only the Hierarchy class can set the hierarchy of a logger.
void callAppenders(const spi::LoggingEventPtr &event, helpers::Pool &p) const
Call the appenders in the hierrachy starting at this.
void debug(const std::wstring &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for DEBUG ev...
void l7dlog(const LevelPtr &level, const std::wstring &key, const log4cxx::spi::LocationInfo &locationInfo) const
Add a new logging event containing locationInfo and the localized message key to attached appender(s)...
void trace(const std::basic_string< UniChar > &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
void l7dlog(const LevelPtr &level, const std::string &key, const log4cxx::spi::LocationInfo &locationInfo, const std::string &val1, const std::string &val2) const
Add a new logging event containing locationInfo and the localized message key using parameters val1 a...
static bool isFatalEnabledFor(const LoggerPtr &logger)
Is logger is enabled for FATAL level logging events?
Definition: log4cxx/logger.h:1366
static LoggerPtr getLogger(const CFStringRef &name)
Retrieve a logger by name.
static LoggerPtr getLogger(const std::wstring &name, const log4cxx::spi::LoggerFactoryPtr &factory)
Like getLogger except that the type of logger instantiated depends on the type returned by the Logger...
void error(const CFStringRef &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void addInfoEvent(helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new INFO level LoggingEvent which was requested at sourceLocation where...
void addErrorEvent(std::basic_string< UniChar > &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new error level logging event containing message and location to attached appender(s) without f...
void forcedLogLS(const LevelPtr &level, const LogString &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to attached appender(s) without further check...
void error(const std::basic_string< UniChar > &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for ERROR ev...
void l7dlog(const LevelPtr &level, const std::basic_string< UniChar > &key, const log4cxx::spi::LocationInfo &locationInfo, const std::basic_string< UniChar > &val) const
Add a new logging event containing locationInfo and the localized message key using parameter val to ...
void fatal(const std::basic_string< UniChar > &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for FATAL ev...
Logger(const LogString &name)
This constructor initializes a new logger instance and sets its name.
void changeParentTo(const LoggerPtr &otherLogger)
Definition: log4cxx/logger.h:1898
void addFatalEvent(std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new fatal level logging event containing message and location to attached appender(s) without f...
static bool isInfoEnabledFor(const LoggerPtr &logger)
Is logger is enabled for INFO level logging events?
Definition: log4cxx/logger.h:1288
static LoggerPtr getLogger(const std::string &name)
Retrieve a logger by name in current encoding.
bool replaceAppender(const AppenderPtr &oldAppender, const AppenderPtr &newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER
Replace oldAppender with newAppender.
bool isDebugEnabled() const
Is this logger is enabled for DEBUG level logging events?
void removeHierarchy()
Only the Hierarchy class can remove the hierarchy of a logger.
void error(const std::string &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void forcedLog(const LevelPtr &level, const std::wstring &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to attached appender(s) without further check...
void info(const std::wstring &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
void getName(std::string &name) const
Put name of this logger into name in current encoding.
void forcedLog(const LevelPtr &level, const std::wstring &message) const
Add a new logging event containing message to attached appender(s) without further checks.
void l7dlog(const LevelPtr &level, const std::basic_string< UniChar > &key, const log4cxx::spi::LocationInfo &locationInfo) const
Add a new logging event containing locationInfo and the localized message key to attached appender(s)...
void fatal(const std::string &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void log(const LevelPtr &level, const std::string &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to the appenders attached to this logger if t...
void addErrorEvent(helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new ERROR level LoggingEvent which was requested at sourceLocation wher...
void fatal(const std::basic_string< UniChar > &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void fatal(const CFStringRef &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
bool getAdditivity() const
Get the additivity flag for this logger.
void getName(CFStringRef &name) const
Put name of this logger into name.
static LoggerPtr getRootLogger()
Retrieve the root logger.
virtual const LevelPtr & getEffectiveLevel() const
Starting from this logger, search the logger hierarchy for a non-null level and return it.
void trace(const std::wstring &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
void log(const LevelPtr &level, const CFStringRef &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to the appenders attached to this logger if t...
void addTraceEvent(std::basic_string< UniChar > &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new trace level logging event containing message and location to attached appender(s) without f...
void addTraceEvent(helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new TRACE level LoggingEvent which was requested at sourceLocation wher...
void addDebugEvent(std::basic_string< UniChar > &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new debug level logging event containing message and location to attached appender(s) without f...
void warn(const std::basic_string< UniChar > &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
void trace(const CFStringRef &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
LoggerPtr getParent() const
The parent of this logger.
void updateThreshold()
Only the Hierarchy class can change the threshold of a logger.
void l7dlog(const LevelPtr &level, const std::wstring &key, const log4cxx::spi::LocationInfo &locationInfo, const std::wstring &val1, const std::wstring &val2) const
Add a new logging event containing locationInfo and the localized message key using parameters val1 a...
void l7dlog(const LevelPtr &level, const LogString &key, const log4cxx::spi::LocationInfo &locationInfo, const std::vector< LogString > &values) const
Add a new logging event containing locationInfo and the localized message key using values for parame...
void forcedLog(const LevelPtr &level, const std::string &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to attached appender(s) without further check...
void l7dlog(const LevelPtr &level, const std::wstring &key, const log4cxx::spi::LocationInfo &locationInfo, const std::wstring &val1, const std::wstring &val2, const std::wstring &val3) const
Add a new logging event containing locationInfo and the localized message key using parameters val1,...
void l7dlog(const LevelPtr &level, const std::string &key, const log4cxx::spi::LocationInfo &locationInfo) const
Add a new logging event containing locationInfo and the localized message key to attached appender(s)...
void closeNestedAppenders()
Close all attached appenders implementing the AppenderAttachable interface.
void info(const CFStringRef &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
void addErrorEvent(std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new error level logging event containing message and location to attached appender(s) without f...
void reconfigure(const AppenderList &newList, bool newAdditivity)
Replace all current appenders with newList and set the additivity flag to newAdditivity.
void info(const std::basic_string< UniChar > &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
void info(const CFStringRef &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO eve...
void debug(const std::wstring &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void l7dlog(const LevelPtr &level, const CFStringRef &key, const log4cxx::spi::LocationInfo &locationInfo, const CFStringRef &val1, const CFStringRef &val2, const CFStringRef &val3) const
Add a new logging event containing locationInfo and the localized message key using parameters val1,...
void addWarnEvent(helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new WARN level LoggingEvent which was requested at sourceLocation where...
void getName(std::basic_string< UniChar > &name) const
Put name of this logger into name.
void addInfoEvent(std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new info level logging event containing message and location to attached appender(s) without fu...
void addDebugEvent(std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new debug level logging event containing message and location to attached appender(s) without f...
void trace(const CFStringRef &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
bool isThresholdValid() const
Is m_threshold the same as getEffectiveLevel()->toInt()
void removeAppender(const AppenderPtr appender) override
Remove the appender passed as parameter form the list of appenders.
static bool isTraceEnabledFor(const LoggerPtr &logger)
Is logger is enabled for TRACE level logging events?
Definition: log4cxx/logger.h:1392
void l7dlog(const LevelPtr &level, const CFStringRef &key, const log4cxx::spi::LocationInfo &locationInfo, const CFStringRef &val1) const
Add a new logging event containing locationInfo and the localized message key using parameter val to ...
void debug(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for DEBUG ev...
bool isErrorEnabled() const
Is this logger is enabled for ERROR level logging events?
void addAppender(const AppenderPtr newAppender) override
Add newAppender to the list of appenders of this Logger instance.
void addTraceEvent(std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new trace level logging event containing message and location to attached appender(s) without f...
void forcedLog(const LevelPtr &level, const std::string &message) const
Add a new logging event containing message to attached appender(s) without further checks.
bool isTraceEnabled() const
Is this logger is enabled for TRACE level logging events?
This class is used by the LOG4CXX_INFO_ASYNC and similar macros to support insertion operators.
Definition: asyncbuffer.h:56
Definition: pool.h:33
This Interface is for attaching Appenders to objects.
Definition: appenderattachable.h:33
This class represents the location of a logging statement.
Definition: locationinfo.h:40
Implement this interface to create new instances of Logger or a sub-class of Logger.
Definition: loggerfactory.h:33
A LoggerRepository is used to create and retrieve Loggers.
Definition: loggerrepository.h:43
const struct __CFString * CFStringRef
Definition: logstring.h:30
std::shared_ptr< LoggerRepository > LoggerRepositoryPtr
Definition: optionconverter.h:32
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:31
std::shared_ptr< LoggerFactory > LoggerFactoryPtr
Definition: logmanager.h:33
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Level > LevelPtr
Definition: optionconverter.h:27
std::shared_ptr< Appender > AppenderPtr
Definition: basicconfigurator.h:28
std::shared_ptr< Logger > LoggerPtr
Definition: defaultloggerfactory.h:26
LOG4CXX_LIST_DEF(LoggerList, LoggerPtr)
std::vector< LoggerPtr > LoggerList
Definition: logmanager.h:29
LOG4CXX_PTR_DEF(Logger)
smart pointer to a Logger class
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:154
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:37
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:148
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:142
#define LOG4CXX_16_VIRTUAL_SPECIFIER
Definition: socket.h:90