Apache log4cxx  Version 0.12.1
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 
21 #if defined(_MSC_VER) && (_MSC_VER < 1900)
22  #pragma warning ( push )
23  #pragma warning ( disable: 4127 )
24 #endif
25 #if defined(_MSC_VER)
26  #pragma warning ( push )
27  #pragma warning ( disable: 4231 4251 4275 4786 )
28 #endif
29 
31 #include <log4cxx/level.h>
32 #include <log4cxx/helpers/pool.h>
36 
37 namespace log4cxx
38 {
39 
40 namespace helpers
41 {
42 class synchronized;
43 }
44 
45 namespace spi
46 {
47 class LoggerRepository;
48 LOG4CXX_PTR_DEF(LoggerRepository);
49 class LoggerFactory;
50 LOG4CXX_PTR_DEF(LoggerFactory);
51 }
52 
53 class Logger;
55 LOG4CXX_PTR_DEF(Logger);
57 
58 
63 class LOG4CXX_EXPORT Logger :
64  public virtual log4cxx::spi::AppenderAttachable,
65  public virtual helpers::Object
66 {
67  public:
73 
74  private:
78  helpers::Pool* pool;
79 
80  protected:
85 
91 
96 
101  helpers::ResourceBundlePtr resourceBundle;
102 
103 
104  // Loggers need to know what Hierarchy they are in
105  log4cxx::spi::LoggerRepositoryWeakPtr repository;
106 
107  helpers::AppenderAttachableImplPtr aai;
108 
116  bool additive;
117 
118  protected:
119  friend class DefaultLoggerFactory;
120 
131  Logger(log4cxx::helpers::Pool& pool, const LogString& name);
132 
133  public:
134  ~Logger();
135 
136 
144  virtual void addAppender(const AppenderPtr newAppender);
145 
146 
159  void callAppenders(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) const;
160 
165  void closeNestedAppenders();
166 
180  void debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
193  void debug(const std::string& msg) const;
194 #if LOG4CXX_WCHAR_T_API
195 
208  void debug(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
221  void debug(const std::wstring& msg) const;
222 #endif
223 #if LOG4CXX_UNICHAR_API
224 
237  void debug(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
250  void debug(const std::basic_string<UniChar>& msg) const;
251 #endif
252 #if LOG4CXX_CFSTRING_API
253 
266  void debug(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
279  void debug(const CFStringRef& msg) const;
280 #endif
281 
295  void error(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
308  void error(const std::string& msg) const;
309 #if LOG4CXX_WCHAR_T_API
310 
322  void error(const std::wstring& msg) const;
336  void error(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
337 #endif
338 #if LOG4CXX_UNICHAR_API
339 
352  void error(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
365  void error(const std::basic_string<UniChar>& msg) const;
366 #endif
367 #if LOG4CXX_CFSTRING_API
368 
381  void error(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
394  void error(const CFStringRef& msg) const;
395 #endif
396 
410  void fatal(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
423  void fatal(const std::string& msg) const;
424 #if LOG4CXX_WCHAR_T_API
425 
438  void fatal(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
451  void fatal(const std::wstring& msg) const;
452 #endif
453 #if LOG4CXX_UNICHAR_API
454 
467  void fatal(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
480  void fatal(const std::basic_string<UniChar>& msg) const;
481 #endif
482 #if LOG4CXX_CFSTRING_API
483 
496  void fatal(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
509  void fatal(const CFStringRef& msg) const;
510 #endif
511 
519  void forcedLog(const LevelPtr& level, const std::string& message,
520  const log4cxx::spi::LocationInfo& location) const;
527  void forcedLog(const LevelPtr& level, const std::string& message) const;
528 
529 #if LOG4CXX_WCHAR_T_API
530 
537  void forcedLog(const LevelPtr& level, const std::wstring& message,
538  const log4cxx::spi::LocationInfo& location) const;
545  void forcedLog(const LevelPtr& level, const std::wstring& message) const;
546 #endif
547 #if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
548 
555  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
556  const log4cxx::spi::LocationInfo& location) const;
563  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
564 #endif
565 #if LOG4CXX_CFSTRING_API
566 
573  void forcedLog(const LevelPtr& level, const CFStringRef& message,
574  const log4cxx::spi::LocationInfo& location) const;
581  void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
582 #endif
583 
590  void forcedLogLS(const LevelPtr& level, const LogString& message,
591  const log4cxx::spi::LocationInfo& location) const;
592 
596  bool getAdditivity() const;
597 
603  AppenderList getAllAppenders() const;
604 
609  AppenderPtr getAppender(const LogString& name) const;
610 
620  virtual const LevelPtr getEffectiveLevel() const;
621 
626  log4cxx::spi::LoggerRepositoryWeakPtr getLoggerRepository() const;
627 
628 
633  const LogString& getName() const
634  {
635  return name;
636  }
641  void getName(std::string& name) const;
642 #if LOG4CXX_WCHAR_T_API
643 
647  void getName(std::wstring& name) const;
648 #endif
649 #if LOG4CXX_UNICHAR_API
650 
654  void getName(std::basic_string<UniChar>& name) const;
655 #endif
656 #if LOG4CXX_CFSTRING_API
657 
661  void getName(CFStringRef& name) const;
662 #endif
663 
670  LoggerPtr getParent() const;
671 
672 
678  LevelPtr getLevel() const;
679 
684  static LoggerPtr getLogger(const std::string& name);
689  static LoggerPtr getLogger(const char* const name);
690 #if LOG4CXX_WCHAR_T_API
691 
695  static LoggerPtr getLogger(const std::wstring& name);
700  static LoggerPtr getLogger(const wchar_t* const name);
701 #endif
702 #if LOG4CXX_UNICHAR_API
703 
707  static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
708 #endif
709 #if LOG4CXX_CFSTRING_API
710 
714  static LoggerPtr getLogger(const CFStringRef& name);
715 #endif
716 
720  static LoggerPtr getLoggerLS(const LogString& name);
721 
725  static LoggerPtr getRootLogger();
726 
740  static LoggerPtr getLoggerLS(const LogString& name,
741  const log4cxx::spi::LoggerFactoryPtr& factory);
755  static LoggerPtr getLogger(const std::string& name,
756  const log4cxx::spi::LoggerFactoryPtr& factory);
757 #if LOG4CXX_WCHAR_T_API
758 
771  static LoggerPtr getLogger(const std::wstring& name,
772  const log4cxx::spi::LoggerFactoryPtr& factory);
773 #endif
774 #if LOG4CXX_UNICHAR_API
775 
788  static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
789  const log4cxx::spi::LoggerFactoryPtr& factory);
790 #endif
791 #if LOG4CXX_CFSTRING_API
792 
805  static LoggerPtr getLogger(const CFStringRef& name,
806  const log4cxx::spi::LoggerFactoryPtr& factory);
807 #endif
808 
818  helpers::ResourceBundlePtr getResourceBundle() const;
819 
820  protected:
830  LogString getResourceBundleString(const LogString& key) const;
831 
832  public:
846  void info(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
847  void info(const std::string& msg) const;
848 #if LOG4CXX_WCHAR_T_API
849 
862  void info(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
875  void info(const std::wstring& msg) const;
876 #endif
877 #if LOG4CXX_UNICHAR_API
878 
891  void info(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
904  void info(const std::basic_string<UniChar>& msg) const;
905 #endif
906 #if LOG4CXX_CFSTRING_API
907 
920  void info(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
933  void info(const CFStringRef& msg) const;
934 #endif
935 
939  bool isAttached(const AppenderPtr appender) const;
940 
975  bool isDebugEnabled() const;
976 
985  bool isEnabledFor(const LevelPtr& level) const;
986 
987 
995  bool isInfoEnabled() const;
996 
1004  bool isWarnEnabled() const;
1005 
1013  bool isErrorEnabled() const;
1014 
1022  bool isFatalEnabled() const;
1023 
1031  bool isTraceEnabled() const;
1032 
1049  void l7dlog(const LevelPtr& level, const LogString& key,
1050  const log4cxx::spi::LocationInfo& locationInfo,
1051  const std::vector<LogString>& values) const;
1066  void l7dlog(const LevelPtr& level, const std::string& key,
1067  const log4cxx::spi::LocationInfo& locationInfo) const;
1083  void l7dlog(const LevelPtr& level, const std::string& key,
1084  const log4cxx::spi::LocationInfo& locationInfo,
1085  const std::string& val1) const;
1102  void l7dlog(const LevelPtr& level, const std::string& key,
1103  const log4cxx::spi::LocationInfo& locationInfo,
1104  const std::string& val1, const std::string& val2) const;
1122  void l7dlog(const LevelPtr& level, const std::string& key,
1123  const log4cxx::spi::LocationInfo& locationInfo,
1124  const std::string& val1, const std::string& val2, const std::string& val3) const;
1125 
1126 #if LOG4CXX_WCHAR_T_API
1127 
1141  void l7dlog(const LevelPtr& level, const std::wstring& key,
1142  const log4cxx::spi::LocationInfo& locationInfo) const;
1158  void l7dlog(const LevelPtr& level, const std::wstring& key,
1159  const log4cxx::spi::LocationInfo& locationInfo,
1160  const std::wstring& val1) const;
1177  void l7dlog(const LevelPtr& level, const std::wstring& key,
1178  const log4cxx::spi::LocationInfo& locationInfo,
1179  const std::wstring& val1, const std::wstring& val2) const;
1197  void l7dlog(const LevelPtr& level, const std::wstring& key,
1198  const log4cxx::spi::LocationInfo& locationInfo,
1199  const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
1200 #endif
1201 #if LOG4CXX_UNICHAR_API
1202 
1216  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1217  const log4cxx::spi::LocationInfo& locationInfo) const;
1233  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1234  const log4cxx::spi::LocationInfo& locationInfo,
1235  const std::basic_string<UniChar>& val1) const;
1252  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1253  const log4cxx::spi::LocationInfo& locationInfo,
1254  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
1272  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1273  const log4cxx::spi::LocationInfo& locationInfo,
1274  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
1275  const std::basic_string<UniChar>& val3) const;
1276 #endif
1277 #if LOG4CXX_CFSTRING_API
1278 
1292  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1293  const log4cxx::spi::LocationInfo& locationInfo) const;
1309  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1310  const log4cxx::spi::LocationInfo& locationInfo,
1311  const CFStringRef& val1) const;
1328  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1329  const log4cxx::spi::LocationInfo& locationInfo,
1330  const CFStringRef& val1, const CFStringRef& val2) const;
1348  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1349  const log4cxx::spi::LocationInfo& locationInfo,
1350  const CFStringRef& val1, const CFStringRef& val2,
1351  const CFStringRef& val3) const;
1352 #endif
1353 
1361  void log(const LevelPtr& level, const std::string& message,
1362  const log4cxx::spi::LocationInfo& location) const;
1370  void log(const LevelPtr& level, const std::string& message) const;
1371 #if LOG4CXX_WCHAR_T_API
1372 
1379  void log(const LevelPtr& level, const std::wstring& message,
1380  const log4cxx::spi::LocationInfo& location) const;
1388  void log(const LevelPtr& level, const std::wstring& message) const;
1389 #endif
1390 #if LOG4CXX_UNICHAR_API
1391 
1398  void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
1399  const log4cxx::spi::LocationInfo& location) const;
1407  void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
1408 #endif
1409 #if LOG4CXX_CFSTRING_API
1410 
1417  void log(const LevelPtr& level, const CFStringRef& message,
1418  const log4cxx::spi::LocationInfo& location) const;
1426  void log(const LevelPtr& level, const CFStringRef& message) const;
1427 #endif
1428 
1435  void logLS(const LevelPtr& level, const LogString& message,
1436  const log4cxx::spi::LocationInfo& location) const;
1437 
1438 
1439 
1445  void removeAllAppenders();
1446 
1450  void removeAppender(const AppenderPtr appender);
1451 
1456  void removeAppender(const LogString& name);
1457 
1461  void setAdditivity(bool additive);
1462 
1463  protected:
1464  friend class Hierarchy;
1467  void setHierarchy(spi::LoggerRepositoryWeakPtr repository);
1468 
1469  public:
1476  virtual void setLevel(const LevelPtr level);
1477 
1481  inline void setResourceBundle(const helpers::ResourceBundlePtr& bundle)
1482  {
1483  resourceBundle = bundle;
1484  }
1485 
1486 #if LOG4CXX_WCHAR_T_API
1487 
1500  void warn(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
1513  void warn(const std::wstring& msg) const;
1514 #endif
1515 #if LOG4CXX_UNICHAR_API
1516 
1529  void warn(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
1542  void warn(const std::basic_string<UniChar>& msg) const;
1543 #endif
1544 #if LOG4CXX_CFSTRING_API
1545 
1558  void warn(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
1571  void warn(const CFStringRef& msg) const;
1572 #endif
1573 
1586  void warn(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
1599  void warn(const std::string& msg) const;
1600 
1601 #if LOG4CXX_WCHAR_T_API
1602 
1615  void trace(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;
1628  void trace(const std::wstring& msg) const;
1629 #endif
1630 #if LOG4CXX_UNICHAR_API
1631 
1644  void trace(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;
1657  void trace(const std::basic_string<UniChar>& msg) const;
1658 #endif
1659 #if LOG4CXX_CFSTRING_API
1660 
1673  void trace(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;
1686  void trace(const CFStringRef& msg) const;
1687 #endif
1688 
1701  void trace(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;
1714  void trace(const std::string& msg) const;
1715 
1722  void reconfigure( const std::vector<AppenderPtr>& appenders, bool additivity );
1723 
1724  private:
1725  //
1726  // prevent copy and assignment
1727  Logger(const Logger&);
1728  Logger& operator=(const Logger&);
1729  mutable shared_mutex mutex;
1730  friend class log4cxx::helpers::synchronized;
1731 };
1733 
1734 }
1735 
1740 #if !defined(LOG4CXX_UNLIKELY)
1741  #if __GNUC__ >= 3
1742 
1748  #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
1749  #else
1750 
1756  #define LOG4CXX_UNLIKELY(expr) expr
1757  #endif
1758 #endif
1759 
1760 
1768 #define LOG4CXX_LOG(logger, level, message) do { \
1769  if (logger->isEnabledFor(level)) {\
1770  ::log4cxx::helpers::MessageBuffer oss_; \
1771  logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1772 
1780 #define LOG4CXX_LOG_FMT(logger, level, ...) do { \
1781  if (logger->isEnabledFor(level)) {\
1782  logger->forcedLog(level, fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1783 
1791 #define LOG4CXX_LOGLS(logger, level, message) do { \
1792  if (logger->isEnabledFor(level)) {\
1793  ::log4cxx::helpers::LogCharMessageBuffer oss_; \
1794  logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1795 
1796 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000
1797 
1803 #define LOG4CXX_DEBUG(logger, message) do { \
1804  if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\
1805  ::log4cxx::helpers::MessageBuffer oss_; \
1806  logger->forcedLog(::log4cxx::Level::getDebug(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1807 
1814 #define LOG4CXX_DEBUG_FMT(logger, ...) do { \
1815  if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\
1816  logger->forcedLog(::log4cxx::Level::getDebug(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1817 #else
1818 #define LOG4CXX_DEBUG(logger, message)
1819 #define LOG4CXX_DEBUG_FMT(logger, ...)
1820 #endif
1821 
1822 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 5000
1823 
1829 #define LOG4CXX_TRACE(logger, message) do { \
1830  if (LOG4CXX_UNLIKELY(logger->isTraceEnabled())) {\
1831  ::log4cxx::helpers::MessageBuffer oss_; \
1832  logger->forcedLog(::log4cxx::Level::getTrace(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1833 
1840 #define LOG4CXX_TRACE_FMT(logger, ...) do { \
1841  if (LOG4CXX_UNLIKELY(logger->isTraceEnabled())) {\
1842  logger->forcedLog(::log4cxx::Level::getTrace(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1843 #else
1844 #define LOG4CXX_TRACE(logger, message)
1845 #define LOG4CXX_TRACE_FMT(logger, ...)
1846 #endif
1847 
1848 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 20000
1849 
1855 #define LOG4CXX_INFO(logger, message) do { \
1856  if (logger->isInfoEnabled()) {\
1857  ::log4cxx::helpers::MessageBuffer oss_; \
1858  logger->forcedLog(::log4cxx::Level::getInfo(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1859 
1867 #define LOG4CXX_INFO_FMT(logger, ...) do { \
1868  if (logger->isInfoEnabled()) {\
1869  logger->forcedLog(::log4cxx::Level::getInfo(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1870 #else
1871 #define LOG4CXX_INFO(logger, message)
1872 #define LOG4CXX_INFO_FMT(logger, ...)
1873 #endif
1874 
1875 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 30000
1876 
1882 #define LOG4CXX_WARN(logger, message) do { \
1883  if (logger->isWarnEnabled()) {\
1884  ::log4cxx::helpers::MessageBuffer oss_; \
1885  logger->forcedLog(::log4cxx::Level::getWarn(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1886 
1893 #define LOG4CXX_WARN_FMT(logger, ...) do { \
1894  if (logger->isWarnEnabled()) {\
1895  logger->forcedLog(::log4cxx::Level::getWarn(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1896 #else
1897 #define LOG4CXX_WARN(logger, message)
1898 #define LOG4CXX_WARN_FMT(logger, ...)
1899 #endif
1900 
1901 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 40000
1902 
1908 #define LOG4CXX_ERROR(logger, message) do { \
1909  if (logger->isErrorEnabled()) {\
1910  ::log4cxx::helpers::MessageBuffer oss_; \
1911  logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1912 
1919 #define LOG4CXX_ERROR_FMT(logger, ...) do { \
1920  if (logger->isErrorEnabled()) {\
1921  logger->forcedLog(::log4cxx::Level::getError(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1922 
1930 #define LOG4CXX_ASSERT(logger, condition, message) do { \
1931  if (!(condition) && logger->isErrorEnabled()) {\
1932  ::log4cxx::helpers::MessageBuffer oss_; \
1933  logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1934 
1942 #define LOG4CXX_ASSERT_FMT(logger, condition, ...) do { \
1943  if (!(condition) && logger->isErrorEnabled()) {\
1944  logger->forcedLog(::log4cxx::Level::getError(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1945 
1946 #else
1947 #define LOG4CXX_ERROR(logger, message)
1948 #define LOG4CXX_ERROR_FMT(logger, ...)
1949 #define LOG4CXX_ASSERT(logger, condition, message)
1950 #define LOG4CXX_ASSERT_FMT(logger, condition, ...)
1951 #endif
1952 
1953 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 50000
1954 
1960 #define LOG4CXX_FATAL(logger, message) do { \
1961  if (logger->isFatalEnabled()) {\
1962  ::log4cxx::helpers::MessageBuffer oss_; \
1963  logger->forcedLog(::log4cxx::Level::getFatal(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
1964 
1971 #define LOG4CXX_FATAL_FMT(logger, ...) do { \
1972  if (logger->isFatalEnabled()) {\
1973  logger->forcedLog(::log4cxx::Level::getFatal(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
1974 #else
1975 #define LOG4CXX_FATAL(logger, message)
1976 #define LOG4CXX_FATAL_FMT(logger, ...)
1977 #endif
1978 
1986 #define LOG4CXX_L7DLOG(logger, level, key) do { \
1987  if (logger->isEnabledFor(level)) {\
1988  logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
1989 
1998 #define LOG4CXX_L7DLOG1(logger, level, key, p1) do { \
1999  if (logger->isEnabledFor(level)) {\
2000  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
2001 
2011 #define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) do { \
2012  if (logger->isEnabledFor(level)) {\
2013  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
2014 
2025 #define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) do { \
2026  if (logger->isEnabledFor(level)) {\
2027  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
2028 
2031 #if defined(_MSC_VER)
2032  #pragma warning ( pop )
2033 #endif
2034 
2036 
2037 #endif //_LOG4CXX_LOGGER_H
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:26
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:148
std::shared_ptr< LoggerFactory > LoggerFactoryPtr
Definition: logmanager.h:38
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:142
std::shared_ptr< Level > LevelPtr
Definition: optionconverter.h:27
LOG4CXX_PTR_DEF(AppenderAttachableImpl)
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:37
This Interface is for attaching Appenders to objects.
Definition: appenderattachable.h:38
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:136
std::vector< LoggerPtr > LoggerList
Definition: logmanager.h:34
LOG4CXX_LIST_DEF(ByteList, unsigned char)
const struct __CFString * CFStringRef
Definition: logstring.h:36
LogString name
The name of this logger.
Definition: logger.h:84
helpers::ResourceBundlePtr resourceBundle
The resourceBundle for localized messages.
Definition: logger.h:101
LoggerPtr parent
The parent of this logger.
Definition: logger.h:95
base class for java-like objects.
Definition: object.h:101
std::shared_ptr< Appender > AppenderPtr
Definition: basicconfigurator.h:28
Definition: defaultloggerfactory.h:29
const LogString & getName() const
Get the logger name.
Definition: logger.h:633
Definition: pool.h:32
LevelPtr level
The assigned level of this logger.
Definition: logger.h:90
This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy...
Definition: hierarchy.h:59
helpers::AppenderAttachableImplPtr aai
Definition: logger.h:107
This class represents the location of a logging statement.
Definition: locationinfo.h:33
bool additive
Additivity is set to true by default, that is children inherit the appenders of their ancestors by de...
Definition: logger.h:116
log4cxx::spi::LoggerRepositoryWeakPtr repository
Definition: logger.h:105
This is the central class in the log4cxx package.
Definition: logger.h:63
std::shared_ptr< Logger > LoggerPtr
Definition: defaultloggerfactory.h:26
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:66
void setResourceBundle(const helpers::ResourceBundlePtr &bundle)
Set the resource bundle to be used with localized logging methods.
Definition: logger.h:1481