Apache Log4cxx  Version 1.3.1
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>
27 
28 namespace LOG4CXX_NS
29 {
30 
31 namespace spi
32 {
33 class LoggerRepository;
35 class LoggerFactory;
37 }
38 
39 class Logger;
43 
44 
49 class LOG4CXX_EXPORT Logger
50  : public virtual spi::AppenderAttachable
51 {
52  public:
58 
59  private:
60  LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggerPrivate, m_priv)
61  int m_threshold;
62 
63  public:
70  Logger(const LogString& name);
71 #if LOG4CXX_ABI_VERSION <= 15
72  [[ deprecated( "Pool is no longer required" ) ]]
73  Logger(helpers::Pool& pool, const LogString& name);
74 #endif
76 
77 
85  void addAppender(const AppenderPtr newAppender) override;
86 
87 
100  void callAppenders(const spi::LoggingEventPtr& event, helpers::Pool& p) const;
101 
107 
121  void debug(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
136  void debug(const std::string& msg) const;
137 #if LOG4CXX_WCHAR_T_API
153  void debug(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
168  void debug(const std::wstring& msg) const;
169 #endif
170 #if LOG4CXX_UNICHAR_API
186  void debug(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
201  void debug(const std::basic_string<UniChar>& msg) const;
202 #endif
203 #if LOG4CXX_CFSTRING_API
219  void debug(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
234  void debug(const CFStringRef& msg) const;
235 #endif
236 
252  void error(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
267  void error(const std::string& msg) const;
268 #if LOG4CXX_WCHAR_T_API
283  void error(const std::wstring& msg) const;
299  void error(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
300 #endif
301 #if LOG4CXX_UNICHAR_API
317  void error(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
332  void error(const std::basic_string<UniChar>& msg) const;
333 #endif
334 #if LOG4CXX_CFSTRING_API
350  void error(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
365  void error(const CFStringRef& msg) const;
366 #endif
367 
383  void fatal(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
398  void fatal(const std::string& msg) const;
399 #if LOG4CXX_WCHAR_T_API
415  void fatal(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
430  void fatal(const std::wstring& msg) const;
431 #endif
432 #if LOG4CXX_UNICHAR_API
448  void fatal(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
463  void fatal(const std::basic_string<UniChar>& msg) const;
464 #endif
465 #if LOG4CXX_CFSTRING_API
481  void fatal(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
496  void fatal(const CFStringRef& msg) const;
497 #endif
498 
506  void addEvent(const LevelPtr& level, std::string&& message
507  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
508 
515  void addFatalEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
516 
523  void addErrorEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
524 
531  void addWarnEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
532 
539  void addInfoEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
540 
547  void addDebugEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
548 
555  void addTraceEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
556 
564  void forcedLog(const LevelPtr& level, const std::string& message,
565  const LOG4CXX_NS::spi::LocationInfo& location) const;
572  void forcedLog(const LevelPtr& level, const std::string& message) const;
573 
574 #if LOG4CXX_WCHAR_T_API
582  void addEvent(const LevelPtr& level, std::wstring&& message
583  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
584 
591  void addFatalEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
592 
599  void addErrorEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
600 
607  void addWarnEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
608 
615  void addInfoEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
616 
623  void addDebugEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
624 
631  void addTraceEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
632 
640  void forcedLog(const LevelPtr& level, const std::wstring& message,
641  const LOG4CXX_NS::spi::LocationInfo& location) const;
648  void forcedLog(const LevelPtr& level, const std::wstring& message) const;
649 #endif
650 #if LOG4CXX_UNICHAR_API
658  void addEvent(const LevelPtr& level, std::basic_string<UniChar>&& message,
659  const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
666  void addFatalEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
673  void addErrorEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
680  void addWarnEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
687  void addInfoEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
694  void addDebugEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
701  void addTraceEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
702 
710  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
711  const LOG4CXX_NS::spi::LocationInfo& location) const;
718  void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
719 #endif
720 #if LOG4CXX_CFSTRING_API
728  void forcedLog(const LevelPtr& level, const CFStringRef& message,
729  const LOG4CXX_NS::spi::LocationInfo& location) const;
736  void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
737 #endif
745  void addEventLS(const LevelPtr& level, LogString&& message
746  , const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
747 
755  void forcedLogLS(const LevelPtr& level, const LogString& message,
756  const LOG4CXX_NS::spi::LocationInfo& location) const;
757 
761  bool getAdditivity() const;
762 
768  AppenderList getAllAppenders() const override;
769 
774  AppenderPtr getAppender(const LogString& name) const override;
775 
785  virtual const LevelPtr& getEffectiveLevel() const;
786 
791  LOG4CXX_NS::spi::LoggerRepository* getLoggerRepository() const;
792 
793 
798  const LogString& getName() const;
799 
804  void getName(std::string& name) const;
805 #if LOG4CXX_WCHAR_T_API
810  void getName(std::wstring& name) const;
811 #endif
812 #if LOG4CXX_UNICHAR_API
817  void getName(std::basic_string<UniChar>& name) const;
818 #endif
819 #if LOG4CXX_CFSTRING_API
824  void getName(CFStringRef& name) const;
825 #endif
826 
834 
835 
841  const LevelPtr& getLevel() const;
842 
847  static LoggerPtr getLogger(const std::string& name);
852  static LoggerPtr getLogger(const char* const name);
853 #if LOG4CXX_WCHAR_T_API
858  static LoggerPtr getLogger(const std::wstring& name);
863  static LoggerPtr getLogger(const wchar_t* const name);
864 #endif
865 #if LOG4CXX_UNICHAR_API
870  static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
871 #endif
872 #if LOG4CXX_CFSTRING_API
877  static LoggerPtr getLogger(const CFStringRef& name);
878 #endif
883  static LoggerPtr getLoggerLS(const LogString& name);
884 
889 
903  static LoggerPtr getLoggerLS(const LogString& name,
904  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
918  static LoggerPtr getLogger(const std::string& name,
919  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
920 #if LOG4CXX_WCHAR_T_API
934  static LoggerPtr getLogger(const std::wstring& name,
935  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
936 #endif
937 #if LOG4CXX_UNICHAR_API
951  static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
952  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
953 #endif
954 #if LOG4CXX_CFSTRING_API
968  static LoggerPtr getLogger(const CFStringRef& name,
969  const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
970 #endif
971 
981  helpers::ResourceBundlePtr getResourceBundle() const;
982 
983  protected:
994 
995  public:
1011  void info(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1026  void info(const std::string& msg) const;
1027 #if LOG4CXX_WCHAR_T_API
1043  void info(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1058  void info(const std::wstring& msg) const;
1059 #endif
1060 #if LOG4CXX_UNICHAR_API
1074  void info(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1089  void info(const std::basic_string<UniChar>& msg) const;
1090 #endif
1091 #if LOG4CXX_CFSTRING_API
1107  void info(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1122  void info(const CFStringRef& msg) const;
1123 #endif
1124 
1128  bool isAttached(const AppenderPtr appender) const override;
1129 
1164  bool isDebugEnabled() const;
1165 
1187  inline static bool isDebugEnabledFor(const LoggerPtr& logger)
1188  {
1189  return logger && logger->m_threshold <= Level::DEBUG_INT && logger->isDebugEnabled();
1190  }
1191 
1197  bool isEnabledFor(const LevelPtr& level) const;
1198 
1199 
1209  bool isInfoEnabled() const;
1210 
1221  inline static bool isInfoEnabledFor(const LoggerPtr& logger)
1222  {
1223  return logger && logger->m_threshold <= Level::INFO_INT && logger->isInfoEnabled();
1224  }
1225 
1235  bool isWarnEnabled() const;
1236 
1247  inline static bool isWarnEnabledFor(const LoggerPtr& logger)
1248  {
1249  return logger && logger->m_threshold <= Level::WARN_INT && logger->isWarnEnabled();
1250  }
1251 
1261  bool isErrorEnabled() const;
1262 
1273  inline static bool isErrorEnabledFor(const LoggerPtr& logger)
1274  {
1275  return logger && logger->m_threshold <= Level::ERROR_INT && logger->isErrorEnabled();
1276  }
1277 
1287  bool isFatalEnabled() const;
1288 
1299  inline static bool isFatalEnabledFor(const LoggerPtr& logger)
1300  {
1301  return logger && logger->m_threshold <= Level::FATAL_INT && logger->isFatalEnabled();
1302  }
1303 
1313  bool isTraceEnabled() const;
1314 
1325  inline static bool isTraceEnabledFor(const LoggerPtr& logger)
1326  {
1327  return logger && logger->m_threshold <= Level::TRACE_INT && logger->isTraceEnabled();
1328  }
1329 
1348  void l7dlog(const LevelPtr& level, const LogString& key,
1349  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1350  const std::vector<LogString>& values) const;
1366  void l7dlog(const LevelPtr& level, const std::string& key,
1367  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1385  void l7dlog(const LevelPtr& level, const std::string& key,
1386  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1387  const std::string& val) const;
1406  void l7dlog(const LevelPtr& level, const std::string& key,
1407  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1408  const std::string& val1, const std::string& val2) const;
1428  void l7dlog(const LevelPtr& level, const std::string& key,
1429  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1430  const std::string& val1, const std::string& val2, const std::string& val3) const;
1431 
1432 #if LOG4CXX_WCHAR_T_API
1448  void l7dlog(const LevelPtr& level, const std::wstring& key,
1449  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1467  void l7dlog(const LevelPtr& level, const std::wstring& key,
1468  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1469  const std::wstring& val) const;
1488  void l7dlog(const LevelPtr& level, const std::wstring& key,
1489  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1490  const std::wstring& val1, const std::wstring& val2) const;
1510  void l7dlog(const LevelPtr& level, const std::wstring& key,
1511  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1512  const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
1513 #endif
1514 #if LOG4CXX_UNICHAR_API
1530  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1531  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1549  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1550  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1551  const std::basic_string<UniChar>& val) const;
1570  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1571  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1572  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
1592  void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1593  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1594  const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
1595  const std::basic_string<UniChar>& val3) const;
1596 #endif
1597 #if LOG4CXX_CFSTRING_API
1613  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1614  const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1632  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1633  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1634  const CFStringRef& val1) const;
1653  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1654  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1655  const CFStringRef& val1, const CFStringRef& val2) const;
1675  void l7dlog(const LevelPtr& level, const CFStringRef& key,
1676  const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1677  const CFStringRef& val1, const CFStringRef& val2,
1678  const CFStringRef& val3) const;
1679 #endif
1680 
1689  void log(const LevelPtr& level, const std::string& message,
1690  const LOG4CXX_NS::spi::LocationInfo& location) const;
1699  void log(const LevelPtr& level, const std::string& message) const;
1700 #if LOG4CXX_WCHAR_T_API
1709  void log(const LevelPtr& level, const std::wstring& message,
1710  const LOG4CXX_NS::spi::LocationInfo& location) const;
1719  void log(const LevelPtr& level, const std::wstring& message) const;
1720 #endif
1721 #if LOG4CXX_UNICHAR_API
1730  void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
1731  const LOG4CXX_NS::spi::LocationInfo& location) const;
1740  void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
1741 #endif
1742 #if LOG4CXX_CFSTRING_API
1751  void log(const LevelPtr& level, const CFStringRef& message,
1752  const LOG4CXX_NS::spi::LocationInfo& location) const;
1761  void log(const LevelPtr& level, const CFStringRef& message) const;
1762 #endif
1771  void logLS(const LevelPtr& level, const LogString& message,
1772  const LOG4CXX_NS::spi::LocationInfo& location) const;
1773 
1774 
1775 
1781  void removeAllAppenders() override;
1782 
1786  void removeAppender(const AppenderPtr appender) override;
1787 
1792  void removeAppender(const LogString& name) override;
1793 
1797  void setAdditivity(bool additive);
1798 
1799  protected:
1800  friend class Hierarchy;
1812  void setParent(LoggerPtr parentLogger);
1817 
1818  private:
1819  spi::LoggerRepository* getHierarchy() const;
1820 
1821  public:
1828  virtual void setLevel(const LevelPtr level);
1829 
1833  void setResourceBundle(const helpers::ResourceBundlePtr& bundle);
1834 
1835 #if LOG4CXX_WCHAR_T_API
1851  void warn(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1866  void warn(const std::wstring& msg) const;
1867 #endif
1868 #if LOG4CXX_UNICHAR_API
1884  void warn(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1899  void warn(const std::basic_string<UniChar>& msg) const;
1900 #endif
1901 #if LOG4CXX_CFSTRING_API
1917  void warn(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1932  void warn(const CFStringRef& msg) const;
1933 #endif
1949  void warn(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1964  void warn(const std::string& msg) const;
1965 
1966 #if LOG4CXX_WCHAR_T_API
1982  void trace(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1997  void trace(const std::wstring& msg) const;
1998 #endif
1999 #if LOG4CXX_UNICHAR_API
2015  void trace(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2030  void trace(const std::basic_string<UniChar>& msg) const;
2031 #endif
2032 #if LOG4CXX_CFSTRING_API
2048  void trace(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2063  void trace(const CFStringRef& msg) const;
2064 #endif
2080  void trace(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2095  void trace(const std::string& msg) const;
2096 
2103  void reconfigure( const std::vector<AppenderPtr>& appenders, bool additivity );
2104 
2105  private:
2106  //
2107  // prevent copy and assignment
2108  Logger(const Logger&);
2109  Logger& operator=(const Logger&);
2110 };
2112 }
2113 
2114 #if !defined(LOG4CXX_UNLIKELY)
2115  #if __GNUC__ >= 3
2122  #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
2123  #else
2130  #define LOG4CXX_UNLIKELY(expr) expr
2131  #endif
2132 #endif
2133 
2134 #if defined(LOG4CXX_ENABLE_STACKTRACE) && !defined(LOG4CXX_STACKTRACE)
2135  #ifndef __has_include
2136  #include <boost/stacktrace.hpp>
2137  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2138  #elif __has_include(<stacktrace>)
2139  #include <stacktrace>
2140  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + std::stacktrace::to_string(std::stacktrace::stacktrace()));
2141  #elif __has_include(<boost/stacktrace.hpp>)
2142  #include <boost/stacktrace.hpp>
2143  #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2144  #else
2145  #warning "Stacktrace requested but no implementation found"
2146  #endif
2147 #endif /* LOG4CXX_ENABLE_STACKTRACE */
2148 
2149 #if !defined(LOG4CXX_STACKTRACE)
2150 #define LOG4CXX_STACKTRACE
2151 #endif
2152 
2153 #ifndef LOG4CXX_FMT_VA_ARG
2154 #if __cplusplus >= 202002L
2155  #define LOG4CXX_FMT_VA_ARG(...) __VA_OPT__(,) __VA_ARGS__
2156 #else
2157  #define LOG4CXX_FMT_VA_ARG(...) , __VA_ARGS__
2158 #endif
2159 #endif
2160 
2172 #define LOG4CXX_LOG(logger, level, message) do { \
2173  if (logger->isEnabledFor(level)) {\
2174  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2175  logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2176 
2185 #define LOG4CXX_LOG_FMT(logger, level, fmt, ...) do { \
2186  if (logger->isEnabledFor(level)) {\
2187  logger->addEvent(level, ::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2188 
2196 #define LOG4CXX_LOGLS(logger, level, message) do { \
2197  if (logger->isEnabledFor(level)) {\
2198  ::LOG4CXX_NS::helpers::LogCharMessageBuffer oss_; \
2199  logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2200 
2201 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000
2221 #define LOG4CXX_DEBUG(logger, message) do { \
2222  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2223  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2224  logger->addDebugEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2225 
2245 #define LOG4CXX_DEBUG_FMT(logger, fmt, ...) do { \
2246  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2247  logger->addDebugEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2248 #else
2249 #define LOG4CXX_DEBUG(logger, message)
2250 #define LOG4CXX_DEBUG_FMT(logger, fmt, ...)
2251 #endif
2252 
2253 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 5000
2265 #define LOG4CXX_TRACE(logger, message) do { \
2266  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2267  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2268  logger->addTraceEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2269 
2282 #define LOG4CXX_TRACE_FMT(logger, fmt, ...) do { \
2283  if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2284  logger->addTraceEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2285 #else
2286 #define LOG4CXX_TRACE(logger, message)
2287 #define LOG4CXX_TRACE_FMT(logger, fmt, ...)
2288 #endif
2289 
2290 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 20000
2307 #define LOG4CXX_INFO(logger, message) do { \
2308  if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2309  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2310  logger->addInfoEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2311 
2328 #define LOG4CXX_INFO_FMT(logger, fmt, ...) do { \
2329  if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2330  logger->addInfoEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2331 #else
2332 #define LOG4CXX_INFO(logger, message)
2333 #define LOG4CXX_INFO_FMT(logger, fmt, ...)
2334 #endif
2335 
2336 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 30000
2351 #define LOG4CXX_WARN(logger, message) do { \
2352  if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2353  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2354  logger->addWarnEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2355 
2371 #define LOG4CXX_WARN_FMT(logger, fmt, ...) do { \
2372  if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2373  logger->addWarnEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2374 #else
2375 #define LOG4CXX_WARN(logger, message)
2376 #define LOG4CXX_WARN_FMT(logger, fmt, ...)
2377 #endif
2378 
2379 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 40000
2394 #define LOG4CXX_ERROR(logger, message) do { \
2395  if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2396  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2397  logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2398 
2414 #define LOG4CXX_ERROR_FMT(logger, fmt, ...) do { \
2415  if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2416  logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2417 
2425 #define LOG4CXX_ASSERT(logger, condition, message) do { \
2426  if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2427  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2428  LOG4CXX_STACKTRACE \
2429  logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2430 
2441 #define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...) do { \
2442  if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2443  LOG4CXX_STACKTRACE \
2444  logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2445 
2446 #else
2447 #define LOG4CXX_ERROR(logger, message)
2448 #define LOG4CXX_ERROR_FMT(logger, fmt, ...)
2449 #define LOG4CXX_ASSERT(logger, condition, message)
2450 #define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...)
2451 #endif
2452 
2453 #if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 50000
2465 #define LOG4CXX_FATAL(logger, message) do { \
2466  if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2467  ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2468  logger->addFatalEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2469 
2482 #define LOG4CXX_FATAL_FMT(logger, fmt, ...) do { \
2483  if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2484  logger->addFatalEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2485 #else
2486 #define LOG4CXX_FATAL(logger, message)
2487 #define LOG4CXX_FATAL_FMT(logger, fmt, ...)
2488 #endif
2489 
2497 #define LOG4CXX_L7DLOG(logger, level, key) do { \
2498  if (logger->isEnabledFor(level)) {\
2499  logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
2500 
2509 #define LOG4CXX_L7DLOG1(logger, level, key, p1) do { \
2510  if (logger->isEnabledFor(level)) {\
2511  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
2512 
2522 #define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) do { \
2523  if (logger->isEnabledFor(level)) {\
2524  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
2525 
2536 #define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) do { \
2537  if (logger->isEnabledFor(level)) {\
2538  logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
2539 
2543 
2544 #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:51
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:1273
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...
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...
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...
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:1247
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...
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 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(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:1187
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:1299
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 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.
log4cxx::spi::LoggerRepository * getLoggerRepository() const
Return the the LoggerRepository where this Logger is attached.
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:1221
static LoggerPtr getLogger(const std::string &name)
Retrieve a logger by name in current encoding.
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 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 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 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 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...
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:1325
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...
void reconfigure(const std::vector< AppenderPtr > &appenders, bool additivity)
Reconfigure this logger by configuring all of the appenders.
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?
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< 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:158
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:39
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:152
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:146