Apache Log4cxx  Version 1.8.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
74  [[ deprecated( "Pool is no longer required" ) ]]
75  Logger(helpers::Pool& pool, const LogString& name);
76 #endif
78 
79 
87  void addAppender(const AppenderPtr newAppender) override;
88 
89 
90 #if LOG4CXX_ABI_VERSION <= 15
104  [[ deprecated( "Pool is no longer required" ) ]]
105  void callAppenders(const spi::LoggingEventPtr& event, helpers::Pool& p) const;
106 #endif
112  void callAppenders(const spi::LoggingEventPtr& event) const;
113 
119 
133  void debug(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
148  void debug(const std::string& msg) const;
149 #if LOG4CXX_WCHAR_T_API
165  void debug(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
180  void debug(const std::wstring& msg) const;
181 #endif
182 #if LOG4CXX_UNICHAR_API
198  void debug(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
213  void debug(const std::basic_string<UniChar>& msg) const;
214 #endif
215 #if LOG4CXX_CFSTRING_API
231  void debug(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
246  void debug(const CFStringRef& msg) const;
247 #endif
248 
264  void error(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
279  void error(const std::string& msg) const;
280 #if LOG4CXX_WCHAR_T_API
295  void error(const std::wstring& msg) const;
311  void error(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
312 #endif
313 #if LOG4CXX_UNICHAR_API
329  void error(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
344  void error(const std::basic_string<UniChar>& msg) const;
345 #endif
346 #if LOG4CXX_CFSTRING_API
362  void error(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
377  void error(const CFStringRef& msg) const;
378 #endif
379 
395  void fatal(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
410  void fatal(const std::string& msg) const;
411 #if LOG4CXX_WCHAR_T_API
427  void fatal(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
442  void fatal(const std::wstring& msg) const;
443 #endif
444 #if LOG4CXX_UNICHAR_API
460  void fatal(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
475  void fatal(const std::basic_string<UniChar>& msg) const;
476 #endif
477 #if LOG4CXX_CFSTRING_API
493  void fatal(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
508  void fatal(const CFStringRef& msg) const;
509 #endif
510 
518  void addEvent(const LevelPtr& level, std::string&& message
519  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
520 
528  void addEvent(const LevelPtr& level, helpers::AsyncBuffer&& messageAppender
529  , const spi::LocationInfo& sourceLocation = spi::LocationInfo::getLocationUnavailable()) const;
530 
537  void addFatalEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
538 
545  void addFatalEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
546 
553  void addErrorEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
554 
561  void addErrorEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
562 
569  void addWarnEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
570 
577  void addWarnEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
578 
585  void addInfoEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
586 
593  void addInfoEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
594 
601  void addDebugEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
602 
609  void addDebugEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
610 
617  void addTraceEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
618 
625  void addTraceEvent(helpers::AsyncBuffer&& messageAppender, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
626 
634  void forcedLog(const LevelPtr& level, const std::string& message,
635  const LOG4CXX_NS::spi::LocationInfo& location) const;
642  void forcedLog(const LevelPtr& level, const std::string& message) const;
643 
644 #if LOG4CXX_WCHAR_T_API
652  void addEvent(const LevelPtr& level, std::wstring&& message
653  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
654 
661  void addFatalEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
662 
669  void addErrorEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
670 
677  void addWarnEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
678 
685  void addInfoEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
686 
693  void addDebugEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
694 
701  void addTraceEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
702 
710  void forcedLog(const LevelPtr& level, const std::wstring& message,
711  const LOG4CXX_NS::spi::LocationInfo& location) const;
718  void forcedLog(const LevelPtr& level, const std::wstring& message) const;
719 #endif
720 #if LOG4CXX_UNICHAR_API
728  void addEvent(const LevelPtr& level, std::basic_string<UniChar>&& message,
729  const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
736  void addFatalEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
743  void addErrorEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
750  void addWarnEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
757  void addInfoEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
764  void addDebugEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
771  void addTraceEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
772 
780  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
781  const LOG4CXX_NS::spi::LocationInfo& location) const;
788  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
789 #endif
790 #if LOG4CXX_CFSTRING_API
798  void forcedLog(const LevelPtr& level, const CFStringRef& message,
799  const LOG4CXX_NS::spi::LocationInfo& location) const;
806  void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
807 #endif
815  void addEventLS(const LevelPtr& level, LogString&& message
816  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
817 
825  void forcedLogLS(const LevelPtr& level, const LogString& message,
826  const LOG4CXX_NS::spi::LocationInfo& location) const;
827 
831  bool getAdditivity() const;
832 
838  AppenderList getAllAppenders() const override;
839 
844  AppenderPtr getAppender(const LogString& name) const override;
845 
855  virtual const LevelPtr& getEffectiveLevel() const;
856 
857 #if LOG4CXX_ABI_VERSION <= 15
863 #endif
864 
869  const LogString& getName() const;
870 
875  void getName(std::string& name) const;
876 #if LOG4CXX_WCHAR_T_API
881  void getName(std::wstring& name) const;
882 #endif
883 #if LOG4CXX_UNICHAR_API
888  void getName(std::basic_string<UniChar>& name) const;
889 #endif
890 #if LOG4CXX_CFSTRING_API
895  void getName(CFStringRef& name) const;
896 #endif
897 
905 
906 
912  const LevelPtr& getLevel() const;
913 
914 #if 15 < LOG4CXX_ABI_VERSION
918  static spi::LoggerRepositoryPtr getLoggerRepository();
919 #endif
920 
925  static LoggerPtr getLogger(const std::string& name);
930  static LoggerPtr getLogger(const char* const name);
931 #if LOG4CXX_WCHAR_T_API
936  static LoggerPtr getLogger(const std::wstring& name);
941  static LoggerPtr getLogger(const wchar_t* const name);
942 #endif
943 #if LOG4CXX_UNICHAR_API
948  static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
949 #endif
950 #if LOG4CXX_CFSTRING_API
955  static LoggerPtr getLogger(const CFStringRef& name);
956 #endif
961  static LoggerPtr getLoggerLS(const LogString& name);
962 
967 
981  static LoggerPtr getLoggerLS(const LogString& name,
982  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
996  static LoggerPtr getLogger(const std::string& name,
997  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
998 #if LOG4CXX_WCHAR_T_API
1012  static LoggerPtr getLogger(const std::wstring& name,
1013  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1014 #endif
1015 #if LOG4CXX_UNICHAR_API
1029  static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
1030  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1031 #endif
1032 #if LOG4CXX_CFSTRING_API
1046  static LoggerPtr getLogger(const CFStringRef& name,
1047  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1048 #endif
1049 
1059  helpers::ResourceBundlePtr getResourceBundle() const;
1060 
1061  protected:
1072 
1073  public:
1089  void info(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1104  void info(const std::string& msg) const;
1105 #if LOG4CXX_WCHAR_T_API
1121  void info(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1136  void info(const std::wstring& msg) const;
1137 #endif
1138 #if LOG4CXX_UNICHAR_API
1152  void info(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1167  void info(const std::basic_string<UniChar>& msg) const;
1168 #endif
1169 #if LOG4CXX_CFSTRING_API
1185  void info(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1200  void info(const CFStringRef& msg) const;
1201 #endif
1202 
1206  bool isAttached(const AppenderPtr appender) const override;
1207 
1242  bool isDebugEnabled() const;
1243 
1265  inline static bool isDebugEnabledFor(const LoggerPtr& logger)
1266  {
1267  return logger && logger->m_threshold <= Level::DEBUG_INT && logger->isDebugEnabled();
1268  }
1269 
1275  bool isEnabledFor(const LevelPtr& level) const;
1276 
1277 
1287  bool isInfoEnabled() const;
1288 
1299  inline static bool isInfoEnabledFor(const LoggerPtr& logger)
1300  {
1301  return logger && logger->m_threshold <= Level::INFO_INT && logger->isInfoEnabled();
1302  }
1303 
1313  bool isWarnEnabled() const;
1314 
1325  inline static bool isWarnEnabledFor(const LoggerPtr& logger)
1326  {
1327  return logger && logger->m_threshold <= Level::WARN_INT && logger->isWarnEnabled();
1328  }
1329 
1339  bool isErrorEnabled() const;
1340 
1351  inline static bool isErrorEnabledFor(const LoggerPtr& logger)
1352  {
1353  return logger && logger->m_threshold <= Level::ERROR_INT && logger->isErrorEnabled();
1354  }
1355 
1365  bool isFatalEnabled() const;
1366 
1377  inline static bool isFatalEnabledFor(const LoggerPtr& logger)
1378  {
1379  return logger && logger->m_threshold <= Level::FATAL_INT && logger->isFatalEnabled();
1380  }
1381 
1391  bool isTraceEnabled() const;
1392 
1403  inline static bool isTraceEnabledFor(const LoggerPtr& logger)
1404  {
1405  return logger && logger->m_threshold <= Level::TRACE_INT && logger->isTraceEnabled();
1406  }
1407 
1426  void l7dlog(const LevelPtr& level, const LogString& key,
1427  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1428  const std::vector<LogString>& values) const;
1444  void l7dlog(const LevelPtr& level, const std::string& key,
1445  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1463  void l7dlog(const LevelPtr& level, const std::string& key,
1464  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1465  const std::string& val) const;
1484  void l7dlog(const LevelPtr& level, const std::string& key,
1485  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1486  const std::string& val1, const std::string& val2) const;
1506  void l7dlog(const LevelPtr& level, const std::string& key,
1507  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1508  const std::string& val1, const std::string& val2, const std::string& val3) const;
1509 
1510 #if LOG4CXX_WCHAR_T_API
1526  void l7dlog(const LevelPtr& level, const std::wstring& key,
1527  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1545  void l7dlog(const LevelPtr& level, const std::wstring& key,
1546  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1547  const std::wstring& val) const;
1566  void l7dlog(const LevelPtr& level, const std::wstring& key,
1567  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1568  const std::wstring& val1, const std::wstring& val2) const;
1588  void l7dlog(const LevelPtr& level, const std::wstring& key,
1589  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1590  const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
1591 #endif
1592 #if LOG4CXX_UNICHAR_API
1608  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1609  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1627  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1628  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1629  const std::basic_string<UniChar>& val) const;
1648  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1649  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1650  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
1670  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1671  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1672  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
1673  const std::basic_string<UniChar>& val3) const;
1674 #endif
1675 #if LOG4CXX_CFSTRING_API
1691  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1692  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1710  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1711  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1712  const CFStringRef& val1) const;
1731  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1732  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1733  const CFStringRef& val1, const CFStringRef& val2) const;
1753  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1754  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1755  const CFStringRef& val1, const CFStringRef& val2,
1756  const CFStringRef& val3) const;
1757 #endif
1758 
1767  void log(const LevelPtr& level, const std::string& message,
1768  const LOG4CXX_NS::spi::LocationInfo& location) const;
1777  void log(const LevelPtr& level, const std::string& message) const;
1778 #if LOG4CXX_WCHAR_T_API
1787  void log(const LevelPtr& level, const std::wstring& message,
1788  const LOG4CXX_NS::spi::LocationInfo& location) const;
1797  void log(const LevelPtr& level, const std::wstring& message) const;
1798 #endif
1799 #if LOG4CXX_UNICHAR_API
1808  void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
1809  const LOG4CXX_NS::spi::LocationInfo& location) const;
1818  void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
1819 #endif
1820 #if LOG4CXX_CFSTRING_API
1829  void log(const LevelPtr& level, const CFStringRef& message,
1830  const LOG4CXX_NS::spi::LocationInfo& location) const;
1839  void log(const LevelPtr& level, const CFStringRef& message) const;
1840 #endif
1849  void logLS(const LevelPtr& level, const LogString& message,
1850  const LOG4CXX_NS::spi::LocationInfo& location) const;
1851 
1852 
1853 
1859  void removeAllAppenders() override;
1860 
1864  void removeAppender(const AppenderPtr appender) override;
1865 
1870  void removeAppender(const LogString& name) override;
1871 
1876  bool replaceAppender(const AppenderPtr& oldAppender, const AppenderPtr& newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER;
1877 
1881  void replaceAppenders(const AppenderList& newList) LOG4CXX_16_VIRTUAL_SPECIFIER;
1882 
1886  void setAdditivity(bool additive);
1887 
1888  protected:
1889  friend class Hierarchy;
1890 
1902  void setParent(LoggerPtr parentLogger);
1907 
1908  public: // Unit testing support methods
1909  void changeParentTo(const LoggerPtr& otherLogger) { setParent(otherLogger); }
1910 
1913  bool isThresholdEqualTo(const LevelPtr& level) const;
1914 
1917  bool isThresholdEqualTo(const LoggerPtr& other) const;
1918 
1921  bool isThresholdValid() const;
1922 
1923  private:
1924  spi::LoggerRepository* getHierarchy() const;
1925 
1926  public:
1933  virtual void setLevel(const LevelPtr level);
1934 
1938  void setResourceBundle(const helpers::ResourceBundlePtr& bundle);
1939 
1940 #if LOG4CXX_WCHAR_T_API
1956  void warn(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1971  void warn(const std::wstring& msg) const;
1972 #endif
1973 #if LOG4CXX_UNICHAR_API
1989  void warn(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2004  void warn(const std::basic_string<UniChar>& msg) const;
2005 #endif
2006 #if LOG4CXX_CFSTRING_API
2022  void warn(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2037  void warn(const CFStringRef& msg) const;
2038 #endif
2054  void warn(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2069  void warn(const std::string& msg) const;
2070 
2071 #if LOG4CXX_WCHAR_T_API
2087  void trace(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2102  void trace(const std::wstring& msg) const;
2103 #endif
2104 #if LOG4CXX_UNICHAR_API
2120  void trace(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2135  void trace(const std::basic_string<UniChar>& msg) const;
2136 #endif
2137 #if LOG4CXX_CFSTRING_API
2153  void trace(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2168  void trace(const CFStringRef& msg) const;
2169 #endif
2185  void trace(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2200  void trace(const std::string& msg) const;
2201 
2209  void reconfigure( const AppenderList& newList, bool newAdditivity );
2210 
2211  private:
2212  //
2213  // prevent copy and assignment
2214  Logger(const Logger&);
2215  Logger& operator=(const Logger&);
2216 };
2218 }
2219 
2220 #if !defined(LOG4CXX_UNLIKELY)
2221  #if __GNUC__ >= 3
2228  #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
2229  #else
2236  #define LOG4CXX_UNLIKELY(expr) expr
2237  #endif
2238 #endif
2239 
2240 #if defined(LOG4CXX_ENABLE_STACKTRACE) && !defined(LOG4CXX_STACKTRACE)
2241  #ifndef __has_include
2242  #include <boost/stacktrace.hpp>
2243  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2244  #elif __has_include(<stacktrace>)
2245  #include <stacktrace>
2246  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + std::stacktrace::to_string(std::stacktrace::stacktrace()));
2247  #elif __has_include(<boost/stacktrace.hpp>)
2248  #include <boost/stacktrace.hpp>
2249  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2250  #else
2251  #warning "Stacktrace requested but no implementation found"
2252  #endif
2253 #endif /* LOG4CXX_ENABLE_STACKTRACE */
2254 
2255 #if !defined(LOG4CXX_STACKTRACE)
2256 #define LOG4CXX_STACKTRACE
2257 #endif
2258 
2259 #ifndef LOG4CXX_FMT_VA_ARG
2260 #if __cplusplus >= 202002L
2261  #define LOG4CXX_FMT_VA_ARG(...) __VA_OPT__(,) __VA_ARGS__
2262 #else
2263  #define LOG4CXX_FMT_VA_ARG(...) , __VA_ARGS__
2264 #endif
2265 #endif
2266 
2278 #define LOG4CXX_LOG(logger, level, message) do { \
2279  if (logger->isEnabledFor(level)) {\
2280  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2281  logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2282 
2291 #define LOG4CXX_LOG_FMT(logger, level, fmt, ...) do { \
2292  if (logger->isEnabledFor(level)) {\
2293  logger->addEvent(level, ::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2294 
2302 #define LOG4CXX_LOGLS(logger, level, message) do { \
2303  if (logger->isEnabledFor(level)) {\
2304  ::LOG4CXX_NS::helpers::LogCharMessageBuffer oss_; \
2305  logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2306 
2307 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000
2327 #define LOG4CXX_DEBUG(logger, message) do { \
2328  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2329  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2330  logger->addDebugEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2331 
2351 #define LOG4CXX_DEBUG_FMT(logger, fmt, ...) do { \
2352  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2353  logger->addDebugEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2354 #else
2355 #define LOG4CXX_DEBUG(logger, message)
2356 #define LOG4CXX_DEBUG_FMT(logger, fmt, ...)
2357 #endif
2358 
2359 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 5000
2371 #define LOG4CXX_TRACE(logger, message) do { \
2372  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2373  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2374  logger->addTraceEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2375 
2388 #define LOG4CXX_TRACE_FMT(logger, fmt, ...) do { \
2389  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2390  logger->addTraceEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2391 #else
2392 #define LOG4CXX_TRACE(logger, message)
2393 #define LOG4CXX_TRACE_FMT(logger, fmt, ...)
2394 #endif
2395 
2396 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 20000
2413 #define LOG4CXX_INFO(logger, message) do { \
2414  if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2415  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2416  logger->addInfoEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2417 
2434 #define LOG4CXX_INFO_FMT(logger, fmt, ...) do { \
2435  if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2436  logger->addInfoEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2437 #else
2438 #define LOG4CXX_INFO(logger, message)
2439 #define LOG4CXX_INFO_FMT(logger, fmt, ...)
2440 #endif
2441 
2442 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 30000
2457 #define LOG4CXX_WARN(logger, message) do { \
2458  if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2459  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2460  logger->addWarnEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2461 
2477 #define LOG4CXX_WARN_FMT(logger, fmt, ...) do { \
2478  if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2479  logger->addWarnEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2480 #else
2481 #define LOG4CXX_WARN(logger, message)
2482 #define LOG4CXX_WARN_FMT(logger, fmt, ...)
2483 #endif
2484 
2485 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 40000
2500 #define LOG4CXX_ERROR(logger, message) do { \
2501  if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2502  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2503  logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2504 
2520 #define LOG4CXX_ERROR_FMT(logger, fmt, ...) do { \
2521  if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2522  logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2523 
2531 #define LOG4CXX_ASSERT(logger, condition, message) do { \
2532  if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2533  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2534  LOG4CXX_STACKTRACE \
2535  logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2536 
2547 #define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...) do { \
2548  if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2549  LOG4CXX_STACKTRACE \
2550  logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2551 
2552 #else
2553 #define LOG4CXX_ERROR(logger, message)
2554 #define LOG4CXX_ERROR_FMT(logger, fmt, ...)
2555 #define LOG4CXX_ASSERT(logger, condition, message)
2556 #define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...)
2557 #endif
2558 
2559 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 50000
2571 #define LOG4CXX_FATAL(logger, message) do { \
2572  if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2573  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2574  logger->addFatalEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2575 
2588 #define LOG4CXX_FATAL_FMT(logger, fmt, ...) do { \
2589  if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2590  logger->addFatalEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2591 #else
2592 #define LOG4CXX_FATAL(logger, message)
2593 #define LOG4CXX_FATAL_FMT(logger, fmt, ...)
2594 #endif
2595 
2603 #define LOG4CXX_L7DLOG(logger, level, key) do { \
2604  if (logger->isEnabledFor(level)) {\
2605  logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
2606 
2615 #define LOG4CXX_L7DLOG1(logger, level, key, p1) do { \
2616  if (logger->isEnabledFor(level)) {\
2617  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
2618 
2628 #define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) do { \
2629  if (logger->isEnabledFor(level)) {\
2630  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
2631 
2642 #define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) do { \
2643  if (logger->isEnabledFor(level)) {\
2644  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
2645 
2649 
2650 #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:1351
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 callAppenders(const spi::LoggingEventPtr &event) const
Send event to all appenders attached to this or attached to a parent of this.
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:1325
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:1265
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:1377
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:1909
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:1299
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:1403
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:109