Author: carnold
Date: Wed Jun 18 14:52:42 2008
New Revision: 669305

URL: http://svn.apache.org/viewvc?rev=669305&view=rev
Log:
LOGCXX-270: Add ability to compile out logging by logging level

Modified:
    logging/log4cxx/trunk/src/changes/changes.xml
    logging/log4cxx/trunk/src/main/include/log4cxx/logger.h

Modified: logging/log4cxx/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/changes/changes.xml?rev=669305&r1=669304&r2=669305&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/changes/changes.xml (original)
+++ logging/log4cxx/trunk/src/changes/changes.xml Wed Jun 18 14:52:42 2008
@@ -28,6 +28,7 @@
 <action issue="LOGCXX-265">Eliminate anachronism warnings</action>
 <action issue="LOGCXX-266">Eliminate Extra ";" ignored warnings</action>
 <action issue="LOGCXX-267">Local variables hide member variables</action>
+<action issue="LOGCXX-270">Add ability to compile out logging by logging 
level.</action>
 <action issue="LOGCXX-271">MDC::put will not overwrite existing key value 
pair</action>
 <action issue="LOGCXX-272">Apache log4cxx 0.10.1 release</action>
 <action issue="LOGCXX-275">Headers cannot be included with very strict warning 
settings</action>

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/logger.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/logger.h?rev=669305&r1=669304&r2=669305&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/logger.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/logger.h Wed Jun 18 14:52:42 
2008
@@ -1770,6 +1770,7 @@
            ::log4cxx::helpers::LogCharMessageBuffer oss_; \
            logger->forcedLog(level, oss_.str(oss_ << message), 
LOG4CXX_LOCATION); } }
 
+#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 10000 
 /**
 Logs a message to a specified logger with the DEBUG level.
 
@@ -1780,7 +1781,11 @@
         if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\
            ::log4cxx::helpers::MessageBuffer oss_; \
            logger->forcedLog(::log4cxx::Level::getDebug(), oss_.str(oss_ << 
message), LOG4CXX_LOCATION); }}
+#else
+#define LOG4CXX_DEBUG(logger, message)
+#endif
 
+#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 5000 
 /**
 Logs a message to a specified logger with the TRACE level.
 
@@ -1791,8 +1796,11 @@
         if (LOG4CXX_UNLIKELY(logger->isTraceEnabled())) {\
            ::log4cxx::helpers::MessageBuffer oss_; \
            logger->forcedLog(::log4cxx::Level::getTrace(), oss_.str(oss_ << 
message), LOG4CXX_LOCATION); }}
+#else
+#define LOG4CXX_TRACE(logger, message)
+#endif
 
-
+#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 20000 
 /**
 Logs a message to a specified logger with the INFO level.
 
@@ -1803,7 +1811,11 @@
         if (logger->isInfoEnabled()) {\
            ::log4cxx::helpers::MessageBuffer oss_; \
            logger->forcedLog(::log4cxx::Level::getInfo(), oss_.str(oss_ << 
message), LOG4CXX_LOCATION); }}
+#else
+#define LOG4CXX_INFO(logger, message)
+#endif
 
+#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 30000 
 /**
 Logs a message to a specified logger with the WARN level.
 
@@ -1814,7 +1826,11 @@
         if (logger->isWarnEnabled()) {\
            ::log4cxx::helpers::MessageBuffer oss_; \
            logger->forcedLog(::log4cxx::Level::getWarn(), oss_.str(oss_ << 
message), LOG4CXX_LOCATION); }}
+#else
+#define LOG4CXX_WARN(logger, message)
+#endif
 
+#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 40000 
 /**
 Logs a message to a specified logger with the ERROR level.
 
@@ -1838,7 +1854,12 @@
            ::log4cxx::helpers::MessageBuffer oss_; \
            logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << 
message), LOG4CXX_LOCATION); }}
 
+#else
+#define LOG4CXX_ERROR(logger, message)
+#define LOG4CXX_ASSERT(logger, condition, message)
+#endif
 
+#if !defined(LOG4CXX_THRESHOLD) || LOG4CXX_THRESHOLD <= 50000 
 /**
 Logs a message to a specified logger with the FATAL level.
 
@@ -1849,6 +1870,9 @@
         if (logger->isFatalEnabled()) {\
            ::log4cxx::helpers::MessageBuffer oss_; \
            logger->forcedLog(::log4cxx::Level::getFatal(), oss_.str(oss_ << 
message), LOG4CXX_LOCATION); }}
+#else
+#define LOG4CXX_FATAL(logger, message)
+#endif           
 
 /**
 Logs a localized message with no parameter.


Reply via email to