You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2004/12/11 06:42:27 UTC

cvs commit: logging-log4cxx/tests/src/varia levelmatchfiltertestcase.cpp

carnold     2004/12/10 21:42:27

  Modified:    include/log4cxx level.h logger.h writerappender.h
               include/log4cxx/nt nteventlogappender.h
               performance main.cpp nullappender.cpp nullappender.h
               tests/src l7dtestcase.cpp minimumtestcase.cpp
               tests/src/net socketservertestcase.cpp
               tests/src/varia levelmatchfiltertestcase.cpp
  Log:
  LOGCXX-10: Conflicting tchar.h: Windows iteration
  
  Revision  Changes    Path
  1.14      +0 -14     logging-log4cxx/include/log4cxx/level.h
  
  Index: level.h
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/include/log4cxx/level.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- level.h	11 Dec 2004 04:53:21 -0000	1.13
  +++ level.h	11 Dec 2004 05:42:26 -0000	1.14
  @@ -22,20 +22,6 @@
   #ifndef _LOG4CXX_LEVEL_H
   #define _LOG4CXX_LEVEL_H
   
  -// Windows specific :
  -// wingdi.h defines ERROR
  -#ifdef ERROR
  -#define OLD_ERROR ERROR
  -#undef ERROR
  -#endif
  -
  -// Windows specific :
  -// atldef.h defines DEBUG
  -#ifdef DEBUG
  -#define OLD_DEBUG DEBUG
  -#undef DEBUG
  -#endif
  -
   
   namespace log4cxx
   {
  
  
  
  1.28      +6 -6      logging-log4cxx/include/log4cxx/logger.h
  
  Index: logger.h
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/include/log4cxx/logger.h,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- logger.h	11 Dec 2004 04:53:21 -0000	1.27
  +++ logger.h	11 Dec 2004 05:42:26 -0000	1.28
  @@ -196,15 +196,15 @@
                   */
           template<class STR>
           void error(const STR& msg, const log4cxx::spi::location::LocationInfo& location) {
  -          if (isEnabledFor(log4cxx::Level::ERROR)) {
  -             forcedLog(log4cxx::Level::ERROR, msg, location);
  +          if (isEnabledFor(log4cxx::Level::getError())) {
  +             forcedLog(log4cxx::Level::getError(), msg, location);
             }
           }
   
           template<class STR>
           void error(const STR& msg) {
  -          if (isEnabledFor(log4cxx::Level::ERROR)) {
  -             forcedLog(log4cxx::Level::ERROR, msg);
  +          if (isEnabledFor(log4cxx::Level::getError())) {
  +             forcedLog(log4cxx::Level::getError(), msg);
             }
           }
   
  @@ -697,7 +697,7 @@
   */
   #define LOG4CXX_ERROR(logger, message) { \
           if (logger->isErrorEnabled()) {\
  -             logger->forcedLog(::log4cxx::Level::ERROR, message, LOG4CXX_LOCATION); }}
  +             logger->forcedLog(::log4cxx::Level::getError(), message, LOG4CXX_LOCATION); }}
   
   /**
   Logs a error if the condition is not true.
  @@ -708,7 +708,7 @@
   */
   #define LOG4CXX_ASSERT(logger, condition, message) { \
           if (!condition && logger->isErrorEnabled()) {\
  -             logger->forcedLog(::log4cxx::Level::ERROR, message, LOG4CXX_LOCATION); }}
  +             logger->forcedLog(::log4cxx::Level::getError(), message, LOG4CXX_LOCATION); }}
   
   
   /**
  
  
  
  1.14      +1 -1      logging-log4cxx/include/log4cxx/writerappender.h
  
  Index: writerappender.h
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/include/log4cxx/writerappender.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- writerappender.h	11 Dec 2004 04:53:21 -0000	1.13
  +++ writerappender.h	11 Dec 2004 05:42:26 -0000	1.14
  @@ -197,7 +197,7 @@
                   WriterAppender(const WriterAppender&);
                   WriterAppender& operator=(const WriterAppender&);
                   apr_iconv_t transcoder;
  -                static const logchar SUBSTITUTION_CHAR = LOG4CXX_STR('?');
  +                enum { SUBSTITUTION_CHAR = LOG4CXX_STR('?') };
                   enum { BUFSIZE = 1024 };
   	};
   }  //namespace log4cxx
  
  
  
  1.13      +1 -1      logging-log4cxx/include/log4cxx/nt/nteventlogappender.h
  
  Index: nteventlogappender.h
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/include/log4cxx/nt/nteventlogappender.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- nteventlogappender.h	11 Dec 2004 04:53:24 -0000	1.12
  +++ nteventlogappender.h	11 Dec 2004 05:42:26 -0000	1.13
  @@ -80,7 +80,7 @@
   			typedef void SID;
   			typedef void* HANDLE;
   
  -			virtual void append(const spi::LoggingEventPtr& event);
  +			virtual void append(const spi::LoggingEventPtr& event, apr_pool_t* p);
   			static HKEY regGetKey(const std::wstring& subkey, unsigned long *disposition);
   			static void regSetString(HKEY hkey, const std::wstring& name, const std::wstring& value);
   			static void regSetDword(HKEY hkey, const std::wstring& name, unsigned long value);
  
  
  
  1.11      +0 -1      logging-log4cxx/performance/main.cpp
  
  Index: main.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/performance/main.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- main.cpp	26 Nov 2004 07:23:30 -0000	1.10
  +++ main.cpp	11 Dec 2004 05:42:26 -0000	1.11
  @@ -14,7 +14,6 @@
    * limitations under the License.
    */
   
  -#include <log4cxx/helpers/tchar.h>
   #include <log4cxx/ndc.h>
   #include <log4cxx/logmanager.h>
   #include <log4cxx/logger.h>
  
  
  
  1.6       +3 -4      logging-log4cxx/performance/nullappender.cpp
  
  Index: nullappender.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/performance/nullappender.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- nullappender.cpp	22 Apr 2004 21:21:33 -0000	1.5
  +++ nullappender.cpp	11 Dec 2004 05:42:26 -0000	1.6
  @@ -37,16 +37,15 @@
   {
   }
   
  -void NullAppender::doAppend(const LoggingEventPtr& event)
  +void NullAppender::doAppend(const LoggingEventPtr& event, apr_pool_t* p)
   {
   	if (layout != 0)
   	{
  -		sbuf.seekp(0);
  -		layout->format(sbuf, event);
  +		layout->format(sbuf, event, p);
   	}
   }
   
  -void NullAppender::append(const LoggingEventPtr& event)
  +void NullAppender::append(const LoggingEventPtr& event, apr_pool_t* p)
   {
   }
   
  
  
  
  1.9       +3 -3      logging-log4cxx/performance/nullappender.h
  
  Index: nullappender.h
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/performance/nullappender.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- nullappender.h	11 Dec 2004 04:53:24 -0000	1.8
  +++ nullappender.h	11 Dec 2004 05:42:26 -0000	1.9
  @@ -39,7 +39,7 @@
   		class NullAppender : public AppenderSkeleton
   		{
   		public:
  -			StringBuffer sbuf;
  +			LogString sbuf;
   
   			DECLARE_LOG4CXX_OBJECT(NullAppender)
   			BEGIN_LOG4CXX_CAST_MAP()
  @@ -50,8 +50,8 @@
   			NullAppender();
   			NullAppender(const LayoutPtr& layout);
   			void close();
  -			void doAppend(const spi::LoggingEventPtr& event);
  -			void append(const spi::LoggingEventPtr& event);
  +			void doAppend(const spi::LoggingEventPtr& event, apr_pool_t* p);
  +			void append(const spi::LoggingEventPtr& event, apr_pool_t* p);
   
   			/**
   			This is a bogus appender but it still uses a layout.
  
  
  
  1.4       +15 -17    logging-log4cxx/tests/src/l7dtestcase.cpp
  
  Index: l7dtestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/l7dtestcase.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- l7dtestcase.cpp	11 Dec 2004 04:53:27 -0000	1.3
  +++ l7dtestcase.cpp	11 Dec 2004 05:42:27 -0000	1.4
  @@ -22,12 +22,12 @@
   #include <log4cxx/helpers/propertyresourcebundle.h>
   
   #include "util/compare.h"
  -#include <apr_pools.h>
  -#include <apr_strings.h>
   
  -#include <vector>
  +#include <vector>
  +#include <sstream>
   
  -#define _T(str) L ## str
  +#define _T(str) L ## str
  +typedef std::basic_ostringstream<wchar_t> StringBuffer;
   
   using namespace log4cxx;
   using namespace log4cxx::helpers;
  @@ -67,10 +67,9 @@
   	void test1()
   	{
   		PropertyConfigurator::configure(LOG4CXX_FILE("input/l7d1.properties"));
  -
  -                apr_pool_t* pool;
  -                apr_status_t rv = apr_pool_create(&pool, NULL);
  -
  +
  +        log4cxx::helpers::Pool pool;
  + 
   		for (int i = 0; i < 3; i++)
   		{
   			root->setResourceBundle(bundles[i]);
  @@ -79,21 +78,20 @@
   			LOG4CXX_L7DLOG(root, Level::INFO, _T("test"));
   			LOG4CXX_L7DLOG(root, Level::WARN, _T("hello_world"));
   
  -
  -                        const char* sbuf = apr_itoa(pool, i+1);
  -			LOG4CXX_L7DLOG2(root, Level::DEBUG, _T("msg1"), sbuf,
  +
  +            StringBuffer os;
  +            os << i + 1;
  +			LOG4CXX_L7DLOG2(root, Level::DEBUG, _T("msg1"), os.str(),
   				 _T("log4j"));
  -			LOG4CXX_L7DLOG2(root, Level::ERROR, _T("bogusMsg"), sbuf,
  +			LOG4CXX_L7DLOG2(root, Level::getError(), _T("bogusMsg"), os.str(),
   				 _T("log4j"));
  -			LOG4CXX_L7DLOG2(root, Level::ERROR, _T("msg1"), sbuf,
  +			LOG4CXX_L7DLOG2(root, Level::getError(), _T("msg1"), os.str(),
   				 _T("log4j"));
   			LOG4CXX_L7DLOG(root, Level::INFO, _T("bogus2"));
   		}
   
  -                apr_pool_destroy(pool);
  -
  -		CPPUNIT_ASSERT(Compare::compare(LOG4CXX_FILE("output/temp"),
  -                        LOG4CXX_FILE("witness/l7d.1")));
  + 		CPPUNIT_ASSERT(Compare::compare(LOG4CXX_FILE("output/temp"),
  +        LOG4CXX_FILE("witness/l7d.1")));
   	}
   
   };
  
  
  
  1.8       +2 -2      logging-log4cxx/tests/src/minimumtestcase.cpp
  
  Index: minimumtestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/minimumtestcase.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- minimumtestcase.cpp	11 Dec 2004 04:53:27 -0000	1.7
  +++ minimumtestcase.cpp	11 Dec 2004 05:42:27 -0000	1.8
  @@ -125,13 +125,13 @@
   		// remembering their level values. In general, the category names
   		// have no bearing to level values.
   		LoggerPtr ERR = Logger::getLogger(_T("ERR"));
  -		ERR->setLevel(Level::ERROR);
  +		ERR->setLevel(Level::getError());
   
   		LoggerPtr INF = Logger::getLogger(_T("INF"));
   		INF->setLevel(Level::INFO);
   
   		LoggerPtr INF_ERR = Logger::getLogger(_T("INF.ERR"));
  -		INF_ERR->setLevel(Level::ERROR);
  +		INF_ERR->setLevel(Level::getError());
   
   		LoggerPtr DEB = Logger::getLogger(_T("DEB"));
   		DEB->setLevel(Level::DEBUG);
  
  
  
  1.11      +3 -3      logging-log4cxx/tests/src/net/socketservertestcase.cpp
  
  Index: socketservertestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/net/socketservertestcase.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- socketservertestcase.cpp	11 Dec 2004 04:53:29 -0000	1.10
  +++ socketservertestcase.cpp	11 Dec 2004 05:42:27 -0000	1.11
  @@ -14,9 +14,6 @@
    * limitations under the License.
    */
   
  -#if defined(WIN32) || defined(_WIN32)
  -	#include <windows.h>
  -#endif
   
   #include <cppunit/TestFixture.h>
   #include <cppunit/extensions/HelperMacros.h>
  @@ -47,6 +44,9 @@
   #define INT64_C(value)  value ## LL
   #endif
   
  +#if defined(WIN32) || defined(_WIN32)
  +	#include <windows.h>
  +#endif
   
   using namespace log4cxx;
   using namespace log4cxx::helpers;
  
  
  
  1.4       +2 -2      logging-log4cxx/tests/src/varia/levelmatchfiltertestcase.cpp
  
  Index: levelmatchfiltertestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/varia/levelmatchfiltertestcase.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- levelmatchfiltertestcase.cpp	11 Dec 2004 04:53:30 -0000	1.3
  +++ levelmatchfiltertestcase.cpp	11 Dec 2004 05:42:27 -0000	1.4
  @@ -85,7 +85,7 @@
   		root->setLevel(Level::DEBUG);
   
   		LevelPtr levelArray[] =
  -			{ Level::DEBUG, Level::INFO, Level::WARN, Level::ERROR, Level::FATAL };
  +			{ Level::DEBUG, Level::INFO, Level::WARN, Level::getError(), Level::FATAL };
   
   		int length = sizeof(levelArray)/sizeof(levelArray[0]);
   
  @@ -123,7 +123,7 @@
   		root->setLevel(Level::DEBUG);
   
   		LevelPtr levelArray[] =
  -			{ Level::DEBUG, Level::INFO, Level::WARN, Level::ERROR, Level::FATAL };
  +			{ Level::DEBUG, Level::INFO, Level::WARN, Level::getError(), Level::FATAL };
   
   		int length = sizeof(levelArray)/sizeof(levelArray[0]);