Apache Log4cxx  Version 1.6.0
Loading...
Searching...
No Matches
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>
28
29namespace LOG4CXX_NS
30{
31
32namespace spi
33{
34class LoggerRepository;
36class LoggerFactory;
38}
39
40class Logger;
44
45
50class LOG4CXX_EXPORT Logger
51 : public virtual spi::AppenderAttachable
52{
53 public:
59
60 private:
61 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggerPrivate, m_priv)
62 int m_threshold;
63
64 public:
71 Logger(const LogString& name);
72#if LOG4CXX_ABI_VERSION <= 15
73 [[ deprecated( "Pool is no longer required" ) ]]
74 Logger(helpers::Pool& pool, const LogString& name);
75#endif
77
78
86 void addAppender(const AppenderPtr newAppender) override;
87
88
102
108
122 void debug(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
137 void debug(const std::string& msg) const;
138#if LOG4CXX_WCHAR_T_API
154 void debug(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
169 void debug(const std::wstring& msg) const;
170#endif
171#if LOG4CXX_UNICHAR_API
187 void debug(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
202 void debug(const std::basic_string<UniChar>& msg) const;
203#endif
204#if LOG4CXX_CFSTRING_API
220 void debug(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
235 void debug(const CFStringRef& msg) const;
236#endif
237
253 void error(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
268 void error(const std::string& msg) const;
269#if LOG4CXX_WCHAR_T_API
284 void error(const std::wstring& msg) const;
300 void error(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
301#endif
302#if LOG4CXX_UNICHAR_API
318 void error(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
333 void error(const std::basic_string<UniChar>& msg) const;
334#endif
335#if LOG4CXX_CFSTRING_API
351 void error(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
366 void error(const CFStringRef& msg) const;
367#endif
368
384 void fatal(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
399 void fatal(const std::string& msg) const;
400#if LOG4CXX_WCHAR_T_API
416 void fatal(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
431 void fatal(const std::wstring& msg) const;
432#endif
433#if LOG4CXX_UNICHAR_API
449 void fatal(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
464 void fatal(const std::basic_string<UniChar>& msg) const;
465#endif
466#if LOG4CXX_CFSTRING_API
482 void fatal(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
497 void fatal(const CFStringRef& msg) const;
498#endif
499
507 void addEvent(const LevelPtr& level, std::string&& message
509
517 void addEvent(const LevelPtr& level, helpers::AsyncBuffer&& messageAppender
518 , const spi::LocationInfo& sourceLocation = spi::LocationInfo::getLocationUnavailable()) const;
519
526 void addFatalEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
527
535
542 void addErrorEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
543
551
558 void addWarnEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
559
567
574 void addInfoEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
575
583
590 void addDebugEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
591
599
606 void addTraceEvent(std::string&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
607
615
623 void forcedLog(const LevelPtr& level, const std::string& message,
624 const LOG4CXX_NS::spi::LocationInfo& location) const;
631 void forcedLog(const LevelPtr& level, const std::string& message) const;
632
633#if LOG4CXX_WCHAR_T_API
641 void addEvent(const LevelPtr& level, std::wstring&& message
643
650 void addFatalEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
651
658 void addErrorEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
659
666 void addWarnEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
667
674 void addInfoEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
675
682 void addDebugEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
683
690 void addTraceEvent(std::wstring&& message, const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
691
699 void forcedLog(const LevelPtr& level, const std::wstring& message,
700 const LOG4CXX_NS::spi::LocationInfo& location) const;
707 void forcedLog(const LevelPtr& level, const std::wstring& message) const;
708#endif
709#if LOG4CXX_UNICHAR_API
717 void addEvent(const LevelPtr& level, std::basic_string<UniChar>&& message,
725 void addFatalEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
732 void addErrorEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
739 void addWarnEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
746 void addInfoEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
753 void addDebugEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
760 void addTraceEvent(std::basic_string<UniChar>&& message,const spi::LocationInfo& location = spi::LocationInfo::getLocationUnavailable()) const;
761
769 void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
770 const LOG4CXX_NS::spi::LocationInfo& location) const;
777 void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
778#endif
779#if LOG4CXX_CFSTRING_API
787 void forcedLog(const LevelPtr& level, const CFStringRef& message,
788 const LOG4CXX_NS::spi::LocationInfo& location) const;
795 void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
796#endif
804 void addEventLS(const LevelPtr& level, LogString&& message
806
814 void forcedLogLS(const LevelPtr& level, const LogString& message,
815 const LOG4CXX_NS::spi::LocationInfo& location) const;
816
820 bool getAdditivity() const;
821
827 AppenderList getAllAppenders() const override;
828
833 AppenderPtr getAppender(const LogString& name) const override;
834
844 virtual const LevelPtr& getEffectiveLevel() const;
845
851
856 const LogString& getName() const;
857
862 void getName(std::string& name) const;
863#if LOG4CXX_WCHAR_T_API
868 void getName(std::wstring& name) const;
869#endif
870#if LOG4CXX_UNICHAR_API
875 void getName(std::basic_string<UniChar>& name) const;
876#endif
877#if LOG4CXX_CFSTRING_API
882 void getName(CFStringRef& name) const;
883#endif
884
892
893
899 const LevelPtr& getLevel() const;
900
905 static LoggerPtr getLogger(const std::string& name);
910 static LoggerPtr getLogger(const char* const name);
911#if LOG4CXX_WCHAR_T_API
916 static LoggerPtr getLogger(const std::wstring& name);
921 static LoggerPtr getLogger(const wchar_t* const name);
922#endif
923#if LOG4CXX_UNICHAR_API
928 static LoggerPtr getLogger(const std::basic_string<UniChar>& name);
929#endif
930#if LOG4CXX_CFSTRING_API
935 static LoggerPtr getLogger(const CFStringRef& name);
936#endif
941 static LoggerPtr getLoggerLS(const LogString& name);
942
947
961 static LoggerPtr getLoggerLS(const LogString& name,
962 const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
976 static LoggerPtr getLogger(const std::string& name,
977 const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
978#if LOG4CXX_WCHAR_T_API
992 static LoggerPtr getLogger(const std::wstring& name,
993 const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
994#endif
995#if LOG4CXX_UNICHAR_API
1009 static LoggerPtr getLogger(const std::basic_string<UniChar>& name,
1010 const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1011#endif
1012#if LOG4CXX_CFSTRING_API
1026 static LoggerPtr getLogger(const CFStringRef& name,
1027 const LOG4CXX_NS::spi::LoggerFactoryPtr& factory);
1028#endif
1029
1039 helpers::ResourceBundlePtr getResourceBundle() const;
1040
1041 protected:
1052
1053 public:
1069 void info(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1084 void info(const std::string& msg) const;
1085#if LOG4CXX_WCHAR_T_API
1101 void info(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1116 void info(const std::wstring& msg) const;
1117#endif
1118#if LOG4CXX_UNICHAR_API
1132 void info(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1147 void info(const std::basic_string<UniChar>& msg) const;
1148#endif
1149#if LOG4CXX_CFSTRING_API
1165 void info(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1180 void info(const CFStringRef& msg) const;
1181#endif
1182
1186 bool isAttached(const AppenderPtr appender) const override;
1187
1222 bool isDebugEnabled() const;
1223
1245 inline static bool isDebugEnabledFor(const LoggerPtr& logger)
1246 {
1247 return logger && logger->m_threshold <= Level::DEBUG_INT && logger->isDebugEnabled();
1248 }
1249
1255 bool isEnabledFor(const LevelPtr& level) const;
1256
1257
1267 bool isInfoEnabled() const;
1268
1279 inline static bool isInfoEnabledFor(const LoggerPtr& logger)
1280 {
1281 return logger && logger->m_threshold <= Level::INFO_INT && logger->isInfoEnabled();
1282 }
1283
1293 bool isWarnEnabled() const;
1294
1305 inline static bool isWarnEnabledFor(const LoggerPtr& logger)
1306 {
1307 return logger && logger->m_threshold <= Level::WARN_INT && logger->isWarnEnabled();
1308 }
1309
1319 bool isErrorEnabled() const;
1320
1331 inline static bool isErrorEnabledFor(const LoggerPtr& logger)
1332 {
1333 return logger && logger->m_threshold <= Level::ERROR_INT && logger->isErrorEnabled();
1334 }
1335
1345 bool isFatalEnabled() const;
1346
1357 inline static bool isFatalEnabledFor(const LoggerPtr& logger)
1358 {
1359 return logger && logger->m_threshold <= Level::FATAL_INT && logger->isFatalEnabled();
1360 }
1361
1371 bool isTraceEnabled() const;
1372
1383 inline static bool isTraceEnabledFor(const LoggerPtr& logger)
1384 {
1385 return logger && logger->m_threshold <= Level::TRACE_INT && logger->isTraceEnabled();
1386 }
1387
1406 void l7dlog(const LevelPtr& level, const LogString& key,
1407 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1408 const std::vector<LogString>& values) const;
1424 void l7dlog(const LevelPtr& level, const std::string& key,
1425 const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1443 void l7dlog(const LevelPtr& level, const std::string& key,
1444 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1445 const std::string& val) const;
1464 void l7dlog(const LevelPtr& level, const std::string& key,
1465 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1466 const std::string& val1, const std::string& val2) const;
1486 void l7dlog(const LevelPtr& level, const std::string& key,
1487 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1488 const std::string& val1, const std::string& val2, const std::string& val3) const;
1489
1490#if LOG4CXX_WCHAR_T_API
1506 void l7dlog(const LevelPtr& level, const std::wstring& key,
1507 const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1525 void l7dlog(const LevelPtr& level, const std::wstring& key,
1526 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1527 const std::wstring& val) const;
1546 void l7dlog(const LevelPtr& level, const std::wstring& key,
1547 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1548 const std::wstring& val1, const std::wstring& val2) const;
1568 void l7dlog(const LevelPtr& level, const std::wstring& key,
1569 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1570 const std::wstring& val1, const std::wstring& val2, const std::wstring& val3) const;
1571#endif
1572#if LOG4CXX_UNICHAR_API
1588 void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1589 const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1607 void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1608 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1609 const std::basic_string<UniChar>& val) const;
1628 void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1629 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1630 const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2) const;
1650 void l7dlog(const LevelPtr& level, const std::basic_string<UniChar>& key,
1651 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1652 const std::basic_string<UniChar>& val1, const std::basic_string<UniChar>& val2,
1653 const std::basic_string<UniChar>& val3) const;
1654#endif
1655#if LOG4CXX_CFSTRING_API
1671 void l7dlog(const LevelPtr& level, const CFStringRef& key,
1672 const LOG4CXX_NS::spi::LocationInfo& locationInfo) const;
1690 void l7dlog(const LevelPtr& level, const CFStringRef& key,
1691 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1692 const CFStringRef& val1) const;
1711 void l7dlog(const LevelPtr& level, const CFStringRef& key,
1712 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1713 const CFStringRef& val1, const CFStringRef& val2) const;
1733 void l7dlog(const LevelPtr& level, const CFStringRef& key,
1734 const LOG4CXX_NS::spi::LocationInfo& locationInfo,
1735 const CFStringRef& val1, const CFStringRef& val2,
1736 const CFStringRef& val3) const;
1737#endif
1738
1747 void log(const LevelPtr& level, const std::string& message,
1748 const LOG4CXX_NS::spi::LocationInfo& location) const;
1757 void log(const LevelPtr& level, const std::string& message) const;
1758#if LOG4CXX_WCHAR_T_API
1767 void log(const LevelPtr& level, const std::wstring& message,
1768 const LOG4CXX_NS::spi::LocationInfo& location) const;
1777 void log(const LevelPtr& level, const std::wstring& message) const;
1778#endif
1779#if LOG4CXX_UNICHAR_API
1788 void log(const LevelPtr& level, const std::basic_string<UniChar>& message,
1789 const LOG4CXX_NS::spi::LocationInfo& location) const;
1798 void log(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
1799#endif
1800#if LOG4CXX_CFSTRING_API
1809 void log(const LevelPtr& level, const CFStringRef& message,
1810 const LOG4CXX_NS::spi::LocationInfo& location) const;
1819 void log(const LevelPtr& level, const CFStringRef& message) const;
1820#endif
1829 void logLS(const LevelPtr& level, const LogString& message,
1830 const LOG4CXX_NS::spi::LocationInfo& location) const;
1831
1832
1833
1839 void removeAllAppenders() override;
1840
1844 void removeAppender(const AppenderPtr appender) override;
1845
1850 void removeAppender(const LogString& name) override;
1851
1856 bool replaceAppender(const AppenderPtr& oldAppender, const AppenderPtr& newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER;
1857
1861 void replaceAppenders(const AppenderList& newList) LOG4CXX_16_VIRTUAL_SPECIFIER;
1862
1866 void setAdditivity(bool additive);
1867
1868 protected:
1869 friend class Hierarchy;
1881 void setParent(LoggerPtr parentLogger);
1886
1887 private:
1888 spi::LoggerRepository* getHierarchy() const;
1889
1890 public:
1897 virtual void setLevel(const LevelPtr level);
1898
1902 void setResourceBundle(const helpers::ResourceBundlePtr& bundle);
1903
1904#if LOG4CXX_WCHAR_T_API
1920 void warn(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1935 void warn(const std::wstring& msg) const;
1936#endif
1937#if LOG4CXX_UNICHAR_API
1953 void warn(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
1968 void warn(const std::basic_string<UniChar>& msg) const;
1969#endif
1970#if LOG4CXX_CFSTRING_API
1986 void warn(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2001 void warn(const CFStringRef& msg) const;
2002#endif
2018 void warn(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2033 void warn(const std::string& msg) const;
2034
2035#if LOG4CXX_WCHAR_T_API
2051 void trace(const std::wstring& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2066 void trace(const std::wstring& msg) const;
2067#endif
2068#if LOG4CXX_UNICHAR_API
2084 void trace(const std::basic_string<UniChar>& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2099 void trace(const std::basic_string<UniChar>& msg) const;
2100#endif
2101#if LOG4CXX_CFSTRING_API
2117 void trace(const CFStringRef& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2132 void trace(const CFStringRef& msg) const;
2133#endif
2149 void trace(const std::string& msg, const LOG4CXX_NS::spi::LocationInfo& location) const;
2164 void trace(const std::string& msg) const;
2165
2173 void reconfigure( const AppenderList& newList, bool newAdditivity );
2174
2175 private:
2176 //
2177 // prevent copy and assignment
2178 Logger(const Logger&);
2179 Logger& operator=(const Logger&);
2180};
2182}
2183
2184#if !defined(LOG4CXX_UNLIKELY)
2185 #if __GNUC__ >= 3
2192 #define LOG4CXX_UNLIKELY(expr) __builtin_expect(expr, 0)
2193 #else
2200 #define LOG4CXX_UNLIKELY(expr) expr
2201 #endif
2202#endif
2203
2204#if defined(LOG4CXX_ENABLE_STACKTRACE) && !defined(LOG4CXX_STACKTRACE)
2205 #ifndef __has_include
2206 #include <boost/stacktrace.hpp>
2207 #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2208 #elif __has_include(<stacktrace>)
2209 #include <stacktrace>
2210 #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + std::stacktrace::to_string(std::stacktrace::stacktrace()));
2211 #elif __has_include(<boost/stacktrace.hpp>)
2212 #include <boost/stacktrace.hpp>
2213 #define LOG4CXX_STACKTRACE ::LOG4CXX_NS::MDC mdc_("stacktrace", LOG4CXX_EOL + boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
2214 #else
2215 #warning "Stacktrace requested but no implementation found"
2216 #endif
2217#endif /* LOG4CXX_ENABLE_STACKTRACE */
2218
2219#if !defined(LOG4CXX_STACKTRACE)
2220#define LOG4CXX_STACKTRACE
2221#endif
2222
2223#ifndef LOG4CXX_FMT_VA_ARG
2224#if __cplusplus >= 202002L
2225 #define LOG4CXX_FMT_VA_ARG(...) __VA_OPT__(,) __VA_ARGS__
2226#else
2227 #define LOG4CXX_FMT_VA_ARG(...) , __VA_ARGS__
2228#endif
2229#endif
2230
2234
2242#define LOG4CXX_LOG(logger, level, message) do { \
2243 if (logger->isEnabledFor(level)) {\
2244 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2245 logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2246
2255#define LOG4CXX_LOG_FMT(logger, level, fmt, ...) do { \
2256 if (logger->isEnabledFor(level)) {\
2257 logger->addEvent(level, ::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2258
2266#define LOG4CXX_LOGLS(logger, level, message) do { \
2267 if (logger->isEnabledFor(level)) {\
2268 ::LOG4CXX_NS::helpers::LogCharMessageBuffer oss_; \
2269 logger->addEvent(level, oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2270
2271#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000
2291#define LOG4CXX_DEBUG(logger, message) do { \
2292 if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2293 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2294 logger->addDebugEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2295
2315#define LOG4CXX_DEBUG_FMT(logger, fmt, ...) do { \
2316 if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isDebugEnabledFor(logger))) {\
2317 logger->addDebugEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__) ), LOG4CXX_LOCATION); }} while (0)
2318#else
2319#define LOG4CXX_DEBUG(logger, message)
2320#define LOG4CXX_DEBUG_FMT(logger, fmt, ...)
2321#endif
2322
2323#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 5000
2335#define LOG4CXX_TRACE(logger, message) do { \
2336 if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2337 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2338 logger->addTraceEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2339
2352#define LOG4CXX_TRACE_FMT(logger, fmt, ...) do { \
2353 if (LOG4CXX_UNLIKELY(::LOG4CXX_NS::Logger::isTraceEnabledFor(logger))) {\
2354 logger->addTraceEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2355#else
2356#define LOG4CXX_TRACE(logger, message)
2357#define LOG4CXX_TRACE_FMT(logger, fmt, ...)
2358#endif
2359
2360#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 20000
2377#define LOG4CXX_INFO(logger, message) do { \
2378 if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2379 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2380 logger->addInfoEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2381
2398#define LOG4CXX_INFO_FMT(logger, fmt, ...) do { \
2399 if (::LOG4CXX_NS::Logger::isInfoEnabledFor(logger)) {\
2400 logger->addInfoEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2401#else
2402#define LOG4CXX_INFO(logger, message)
2403#define LOG4CXX_INFO_FMT(logger, fmt, ...)
2404#endif
2405
2406#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 30000
2421#define LOG4CXX_WARN(logger, message) do { \
2422 if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2423 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2424 logger->addWarnEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2425
2441#define LOG4CXX_WARN_FMT(logger, fmt, ...) do { \
2442 if (::LOG4CXX_NS::Logger::isWarnEnabledFor(logger)) {\
2443 logger->addWarnEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2444#else
2445#define LOG4CXX_WARN(logger, message)
2446#define LOG4CXX_WARN_FMT(logger, fmt, ...)
2447#endif
2448
2449#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 40000
2464#define LOG4CXX_ERROR(logger, message) do { \
2465 if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2466 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2467 logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2468
2484#define LOG4CXX_ERROR_FMT(logger, fmt, ...) do { \
2485 if (::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2486 logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2487
2495#define LOG4CXX_ASSERT(logger, condition, message) do { \
2496 if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2497 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2498 LOG4CXX_STACKTRACE \
2499 logger->addErrorEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2500
2511#define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...) do { \
2512 if (!(condition) && ::LOG4CXX_NS::Logger::isErrorEnabledFor(logger)) {\
2513 LOG4CXX_STACKTRACE \
2514 logger->addErrorEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2515
2516#else
2517#define LOG4CXX_ERROR(logger, message)
2518#define LOG4CXX_ERROR_FMT(logger, fmt, ...)
2519#define LOG4CXX_ASSERT(logger, condition, message)
2520#define LOG4CXX_ASSERT_FMT(logger, condition, fmt, ...)
2521#endif
2522
2523#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 50000
2535#define LOG4CXX_FATAL(logger, message) do { \
2536 if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2537 ::LOG4CXX_NS::helpers::MessageBuffer oss_; \
2538 logger->addFatalEvent(oss_.extract_str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
2539
2552#define LOG4CXX_FATAL_FMT(logger, fmt, ...) do { \
2553 if (::LOG4CXX_NS::Logger::isFatalEnabledFor(logger)) {\
2554 logger->addFatalEvent(::LOG4CXX_FORMAT_NS::format(fmt LOG4CXX_FMT_VA_ARG(__VA_ARGS__)), LOG4CXX_LOCATION); }} while (0)
2555#else
2556#define LOG4CXX_FATAL(logger, message)
2557#define LOG4CXX_FATAL_FMT(logger, fmt, ...)
2558#endif
2559
2567#define LOG4CXX_L7DLOG(logger, level, key) do { \
2568 if (logger->isEnabledFor(level)) {\
2569 logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)
2570
2579#define LOG4CXX_L7DLOG1(logger, level, key, p1) do { \
2580 if (logger->isEnabledFor(level)) {\
2581 logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)
2582
2592#define LOG4CXX_L7DLOG2(logger, level, key, p1, p2) do { \
2593 if (logger->isEnabledFor(level)) {\
2594 logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)
2595
2606#define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3) do { \
2607 if (logger->isEnabledFor(level)) {\
2608 logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)
2609
2611
2613
2614#endif //_LOG4CXX_LOGGER_H
#define LOG4CXX_16_VIRTUAL_SPECIFIER
Definition appenderattachable.h:99
@ DEBUG_INT
Definition level.h:216
@ WARN_INT
Definition level.h:214
@ INFO_INT
Definition level.h:215
@ ERROR_INT
Definition level.h:213
@ FATAL_INT
Definition level.h:212
@ TRACE_INT
Definition level.h:217
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...
void setAdditivity(bool additive)
Set the additivity flag for this logger.
virtual const LevelPtr & getEffectiveLevel() const
Starting from this logger, search the logger hierarchy for a non-null level and return it.
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...
friend class Hierarchy
Definition log4cxx/logger.h:1869
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:1331
void addDebugEvent(helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add to attached appender(s) a new DEBUG level LoggingEvent which was requested at sourceLocation wher...
void log(const LevelPtr &level, const std::basic_string< UniChar > &message, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing message and location to the appenders attached to this logger if t...
void error(const std::basic_string< UniChar > &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
void warn(const std::basic_string< UniChar > &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
static LoggerPtr getLoggerLS(const LogString &name, const log4cxx::spi::LoggerFactoryPtr &factory)
Like getLogger except that the type of logger instantiated depends on the type returned by the Logger...
void debug(const CFStringRef &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for DEBUG ev...
static LoggerPtr getLoggerLS(const LogString &name)
Retrieve a logger by name in Unicode.
void setResourceBundle(const helpers::ResourceBundlePtr &bundle)
Set the resource bundle to be used with localized logging methods.
AppenderList getAllAppenders() const override
Get the appenders contained in this logger as an AppenderList.
Logger(helpers::Pool &pool, const LogString &name)
void addEvent(const LevelPtr &level, std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new logging event containing message and location to attached appender(s) without further check...
void warn(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN eve...
void error(const std::wstring &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for ERROR ev...
void addWarnEvent(std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
Add a new warning level logging event containing message and location to attached appender(s) without...
void l7dlog(const LevelPtr &level, const std::basic_string< UniChar > &key, const log4cxx::spi::LocationInfo &locationInfo, const std::basic_string< UniChar > &val1, const std::basic_string< UniChar > &val2, const std::basic_string< UniChar > &val3) const
Add a new logging event containing locationInfo and the localized message key using parameters val1,...
void trace(const std::string &msg) const
Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE ev...
static LoggerPtr getLogger(const std::wstring &name)
Retrieve a logger by name.
helpers::ResourceBundlePtr getResourceBundle() const
Return the inherited ResourceBundle for this logger.
void fatal(const std::wstring &msg, const log4cxx::spi::LocationInfo &location) const
Add a new logging event containing msg and location to attached appender(s) if this logger is enabled...
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 ...
spi::LoggerRepository * getLoggerRepository() const
Return the the LoggerRepository where this Logger is attached.
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...
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 ...
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...
const LogString & getName() const
Get the logger name.
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:1305
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 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:1245
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:1357
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 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:1279
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?
const LevelPtr & getLevel() const
The assigned Level, if any, for this logger.
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.
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...
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:1383
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:43
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
static const LocationInfo & getLocationUnavailable()
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
LOG4CXX_PTR_DEF(LoggerRepository)
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition appender.h:32
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr)
std::basic_string< logchar > LogString
Definition logstring.h:60
std::shared_ptr< Level > LevelPtr
Definition optionconverter.h:28
LOG4CXX_PTR_DEF(Appender)
std::shared_ptr< Appender > AppenderPtr
Definition basicconfigurator.h:29
std::shared_ptr< Logger > LoggerPtr
Definition defaultloggerfactory.h:27
std::vector< LoggerPtr > LoggerList
Definition logmanager.h:29
#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