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/10/22 09:47:59 UTC
cvs commit: logging-log4cxx/tests/src/nt Makefile.am nteventlogappendertestcase.cpp
carnold 2004/10/22 00:47:59
Modified: include/log4cxx appenderskeleton.h
include/log4cxx/config propertysetter.h
include/log4cxx/helpers onlyonceerrorhandler.h
include/log4cxx/varia fallbackerrorhandler.h
src consoleappender.cpp fallbackerrorhandler.cpp
fileappender.cpp odbcappender.cpp
onlyonceerrorhandler.cpp propertysetter.cpp
smtpappender.cpp socketappender.cpp
sockethubappender.cpp syslogappender.cpp
telnetappender.cpp xmlsocketappender.cpp
tests/src Makefile.am asyncappendertestcase.cpp
Added: tests/src appenderskeletontestcase.cpp
appenderskeletontestcase.h
consoleappendertestcase.cpp
dailyrollingfileappendertestcase.cpp
fileappendertestcase.cpp fileappendertestcase.h
rollingfileappendertestcase.cpp
writerappendertestcase.cpp writerappendertestcase.h
tests/src/db Makefile.am odbcappendertestcase.cpp
tests/src/net smtpappendertestcase.cpp
socketappendertestcase.cpp
sockethubappendertestcase.cpp
syslogappendertestcase.cpp
telnetappendertestcase.cpp
xmlsocketappendertestcase.cpp
tests/src/nt Makefile.am nteventlogappendertestcase.cpp
Log:
LOGCXX-29: Appender attributes are not passed to base class setOption correctly
Revision Changes Path
1.13 +6 -6 logging-log4cxx/include/log4cxx/appenderskeleton.h
Index: appenderskeleton.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/appenderskeleton.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- appenderskeleton.h 11 May 2004 06:42:17 -0000 1.12
+++ appenderskeleton.h 22 Oct 2004 07:47:58 -0000 1.13
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#ifndef _LOG4CXX_APPENDER_SKELETON_H
#define _LOG4CXX_APPENDER_SKELETON_H
@@ -56,7 +56,7 @@
/** The first filter in the filter chain. Set to <code>null</code>
initially. */
spi::FilterPtr headFilter;
-
+
/** The last filter in the filter chain. */
spi::FilterPtr tailFilter;
@@ -84,7 +84,7 @@
requires it.
*/
void activateOptions() {}
- void setOption(const String& name, const String& value);
+ void setOption(const String& option, const String& value);
/**
Add a filter to end of the filter list.
1.9 +14 -14 logging-log4cxx/include/log4cxx/config/propertysetter.h
Index: propertysetter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/config/propertysetter.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- propertysetter.h 24 Apr 2004 06:55:01 -0000 1.8
+++ propertysetter.h 22 Oct 2004 07:47:58 -0000 1.9
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#ifndef _LOG4CXX_CONFIG_PROPERTYSETTER_H
#define _LOG4CXX_CONFIG_PROPERTYSETTER_H
@@ -28,7 +28,7 @@
typedef ObjectPtrT<Object> ObjectPtr;
class Properties;
- }
+ }
namespace config
{
@@ -44,15 +44,15 @@
ps.set("age", "32");
ps.set("isMale", "true");
</pre>
-will cause the invocations anObject->setOption("name", "Joe"),
+will cause the invocations anObject->setOption("name", "Joe"),
anObject->setOption("age", "32") and anObject->setOption("isMale", "true")
if the spi::OptionHandler interface is supported by anObject.
*/
class LOG4CXX_EXPORT PropertySetter
{
- protected:
+ protected:
helpers::ObjectPtr obj;
-
+
public:
/**
Create a new PropertySetter for the specified Object. This is done
@@ -61,7 +61,7 @@
@param obj the object for which to set properties
*/
PropertySetter(helpers::ObjectPtr obj);
-
+
/**
Set the properties of an object passed as a parameter in one
go. The <code>properties</code> are parsed relative to a
@@ -71,24 +71,24 @@
@param properties A java.util.Properties containing keys and values.
@param prefix Only keys having the specified prefix will be set.
*/
- static void setProperties(helpers::ObjectPtr obj,
+ static void setProperties(helpers::ObjectPtr obj,
helpers::Properties& properties, const String& prefix);
-
+
/**
Set the properites for the object that match the
<code>prefix</code> passed as parameter.
*/
void setProperties(helpers::Properties& properties, const String& prefix);
-
+
/**
Set a property on this PropertySetter's Object. If the underlying
-Object supports the spi::OptionHandler interface, the
+Object supports the spi::OptionHandler interface, the
{@link spi::OptionHandler#setOption setOption} method is called.
@param name name of the property
@param value String value of the property
*/
- void setProperty(const String& name, const String& value);
+ void setProperty(const String& option, const String& value);
void activate();
}; // class PropertySetter
1.12 +8 -8 logging-log4cxx/include/log4cxx/helpers/onlyonceerrorhandler.h
Index: onlyonceerrorhandler.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/onlyonceerrorhandler.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- onlyonceerrorhandler.h 24 Apr 2004 06:55:01 -0000 1.11
+++ onlyonceerrorhandler.h 22 Oct 2004 07:47:58 -0000 1.12
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#ifndef _LOG4CXX_HELPERS_ONLY_ONCE_ERROR_HANDLER_H
#define _LOG4CXX_HELPERS_ONLY_ONCE_ERROR_HANDLER_H
@@ -34,7 +34,7 @@
<p>This policy aims at protecting an otherwise working application
from being flooded with error messages when logging fails
*/
- class LOG4CXX_EXPORT OnlyOnceErrorHandler :
+ class LOG4CXX_EXPORT OnlyOnceErrorHandler :
public virtual spi::ErrorHandler,
public virtual ObjectImpl
{
@@ -62,7 +62,7 @@
No options to activate.
*/
void activateOptions();
- void setOption(const String& name, const String& value);
+ void setOption(const String& option, const String& value);
/**
@@ -76,7 +76,7 @@
*/
void error(const String& message, Exception& e,
int errorCode, const spi::LoggingEventPtr& event) const;
-
+
/**
Print a the error message passed as parameter on
<code>System.err</code>.
@@ -97,4 +97,4 @@
}; // namespace log4cxx
#endif //_LOG4CXX_HELPERS_ONLY_ONCE_ERROR_HANDLER_H
-
+
1.5 +9 -9 logging-log4cxx/include/log4cxx/varia/fallbackerrorhandler.h
Index: fallbackerrorhandler.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/varia/fallbackerrorhandler.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- fallbackerrorhandler.h 24 Apr 2004 06:55:03 -0000 1.4
+++ fallbackerrorhandler.h 22 Oct 2004 07:47:58 -0000 1.5
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#ifndef _LOG4CXX_VARIA_FALLBACK_ERROR_HANDLER_H
#define _LOG4CXX_VARIA_FALLBACK_ERROR_HANDLER_H
@@ -32,11 +32,11 @@
interface such that a secondary appender may be specified. This
secondary appender takes over if the primary appender fails for
whatever reason.
-
+
<p>The error message is printed on <code>System.err</code>, and
logged in the new secondary appender.
*/
- class LOG4CXX_EXPORT FallbackErrorHandler :
+ class LOG4CXX_EXPORT FallbackErrorHandler :
public virtual spi::ErrorHandler,
public virtual helpers::ObjectImpl
{
@@ -65,7 +65,7 @@
No options to activate.
*/
void activateOptions();
- void setOption(const String& name, const String& value);
+ void setOption(const String& option, const String& value);
/**
@@ -85,7 +85,7 @@
/**
Print a the error message passed as parameter on
- <code>System.err</code>.
+ <code>System.err</code>.
*/
void error(const String& message) const {}
@@ -109,4 +109,4 @@
}; // namespace log4cxx
#endif //_LOG4CXX_VARIA_FALLBACK_ERROR_HANDLER_H
-
+
1.8 +1 -1 logging-log4cxx/src/consoleappender.cpp
Index: consoleappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/consoleappender.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- consoleappender.cpp 21 Oct 2004 04:53:44 -0000 1.7
+++ consoleappender.cpp 22 Oct 2004 07:47:58 -0000 1.8
@@ -112,7 +112,7 @@
}
else
{
- AppenderSkeleton::setOption(option, value);
+ WriterAppender::setOption(option, value);
}
}
1.5 +8 -8 logging-log4cxx/src/fallbackerrorhandler.cpp
Index: fallbackerrorhandler.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/fallbackerrorhandler.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- fallbackerrorhandler.cpp 30 Apr 2004 17:34:02 -0000 1.4
+++ fallbackerrorhandler.cpp 22 Oct 2004 07:47:58 -0000 1.5
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/appender.h>
#include <log4cxx/logger.h>
#include <log4cxx/varia/fallbackerrorhandler.h>
@@ -40,7 +40,7 @@
void FallbackErrorHandler::error(const String& message, helpers::Exception& e,
int errorCode) const
-{
+{
error(message, e, errorCode, 0);
}
@@ -60,12 +60,12 @@
LogLog::debug(_T("FB: Adding appender [")+backup->getName()+_T("] to logger ")
+ l->getName());
l->addAppender(backup);
- }
+ }
}
void FallbackErrorHandler::setAppender(const AppenderPtr& primary)
{
- LogLog::debug(_T("FB: Setting primary appender to [") +
+ LogLog::debug(_T("FB: Setting primary appender to [") +
primary->getName() + _T("]."));
this->primary = primary;
}
@@ -81,7 +81,7 @@
{
}
-void FallbackErrorHandler::setOption(const String& name, const String& value)
+void FallbackErrorHandler::setOption(const String& option, const String& value)
{
}
1.11 +7 -7 logging-log4cxx/src/fileappender.cpp
Index: fileappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/fileappender.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- fileappender.cpp 22 Apr 2004 21:21:33 -0000 1.10
+++ fileappender.cpp 22 Oct 2004 07:47:58 -0000 1.11
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/fileappender.h>
#include <log4cxx/helpers/stringhelper.h>
#include <log4cxx/helpers/loglog.h>
@@ -65,11 +65,11 @@
fileName = StringHelper::trim(file);
}
-void FileAppender::setFile(const String& fileName, bool append,
+void FileAppender::setFile(const String& fileName, bool append,
bool bufferedIO, int bufferSize)
{
synchronized sync(this);
-
+
LOGLOG_DEBUG(_T("FileAppender::activateOptions called : ")
<< fileName << _T(", ") << append);
// It does not make sense to have immediate flush and bufferedIO.
@@ -163,7 +163,7 @@
}
else
{
- WriterAppender::setOption(name, value);
+ WriterAppender::setOption(option, value);
}
}
1.13 +17 -17 logging-log4cxx/src/odbcappender.cpp
Index: odbcappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/odbcappender.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- odbcappender.cpp 13 Aug 2004 12:27:48 -0000 1.12
+++ odbcappender.cpp 22 Oct 2004 07:47:58 -0000 1.13
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/portability.h>
#if defined(WIN32) || defined(_WIN32)
@@ -72,14 +72,14 @@
}
else
{
- AppenderSkeleton::setOption(name, value);
+ AppenderSkeleton::setOption(option, value);
}
}
void ODBCAppender::append(const spi::LoggingEventPtr& event)
{
buffer.push_back(event);
-
+
if (buffer.size() >= bufferSize)
flushBuffer();
}
@@ -100,7 +100,7 @@
try
{
con = getConnection();
-
+
ret = SQLAllocHandle(SQL_HANDLE_STMT, con, &stmt);
if (ret < 0)
{
@@ -117,7 +117,7 @@
{
throw SQLException(ret);
}
- }
+ }
catch (SQLException& e)
{
if (stmt != SQL_NULL_HSTMT)
@@ -129,7 +129,7 @@
}
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
closeConnection(con);
-
+
//tcout << _T("Execute: ") << sql << std::endl;
}
@@ -151,7 +151,7 @@
env = SQL_NULL_HENV;
throw SQLException(ret);
}
-
+
ret = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);
if (ret < 0)
{
@@ -160,7 +160,7 @@
throw SQLException(ret);
}
}
-
+
if (connection == SQL_NULL_HDBC)
{
ret = SQLAllocHandle(SQL_HANDLE_DBC, env, &connection);
@@ -193,7 +193,7 @@
throw SQLException(ret);
}
}
-
+
return connection;
}
@@ -202,10 +202,10 @@
try
{
flushBuffer();
- }
+ }
catch (SQLException& e)
{
- errorHandler->error(_T("Error closing connection"),
+ errorHandler->error(_T("Error closing connection"),
e, ErrorCode::GENERIC_FAILURE);
}
@@ -214,12 +214,12 @@
SQLDisconnect(connection);
SQLFreeHandle(SQL_HANDLE_DBC, connection);
}
-
+
if (env != SQL_NULL_HENV)
{
SQLFreeHandle(SQL_HANDLE_ENV, env);
}
-
+
this->closed = true;
}
@@ -243,7 +243,7 @@
ErrorCode::FLUSH_FAILURE);
}
}
-
+
// clear the buffer of reported events
buffer.clear();
}
1.9 +5 -5 logging-log4cxx/src/onlyonceerrorhandler.cpp
Index: onlyonceerrorhandler.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/onlyonceerrorhandler.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- onlyonceerrorhandler.cpp 22 Apr 2004 21:21:33 -0000 1.8
+++ onlyonceerrorhandler.cpp 22 Oct 2004 07:47:58 -0000 1.9
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/appender.h>
#include <log4cxx/logger.h>
#include <log4cxx/helpers/onlyonceerrorhandler.h>
@@ -40,7 +40,7 @@
{
}
-void OnlyOnceErrorHandler::setOption(const String& name, const String& value)
+void OnlyOnceErrorHandler::setOption(const String& option, const String& value)
{
}
1.6 +12 -12 logging-log4cxx/src/propertysetter.cpp
Index: propertysetter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/propertysetter.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- propertysetter.cpp 22 Apr 2004 21:21:34 -0000 1.5
+++ propertysetter.cpp 22 Oct 2004 07:47:58 -0000 1.6
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/helpers/object.h>
#include <log4cxx/config/propertysetter.h>
#include <log4cxx/helpers/loglog.h>
@@ -48,7 +48,7 @@
for (it = names.begin(); it != names.end(); it++)
{
String key = *it;
-
+
// handle only properties that start with the desired frefix.
if (key.find(prefix) == 0)
{
@@ -57,30 +57,30 @@
{
continue;
}
-
+
String value = OptionConverter::findAndSubst(key, properties);
key = key.substr(len);
if (key == _T("layout")
&& obj->instanceof(Appender::getStaticClass()))
{
continue;
- }
+ }
setProperty(key, value);
}
}
activate();
}
-void PropertySetter::setProperty(const String& name, const String& value)
+void PropertySetter::setProperty(const String& option, const String& value)
{
if (value.empty())
return;
-
+
if (obj->instanceof(OptionHandler::getStaticClass()))
{
- LogLog::debug(_T("Setting option name=[") +
- name + _T("], value=[") + value + _T("]"));
- OptionHandlerPtr(obj)->setOption(name, value);
+ LogLog::debug(_T("Setting option name=[") +
+ option + _T("], value=[") + value + _T("]"));
+ OptionHandlerPtr(obj)->setOption(option, value);
}
}
1.8 +5 -5 logging-log4cxx/src/smtpappender.cpp
Index: smtpappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/smtpappender.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- smtpappender.cpp 13 Aug 2004 12:27:48 -0000 1.7
+++ smtpappender.cpp 22 Oct 2004 07:47:58 -0000 1.8
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/portability.h>
#ifdef LOG4CXX_HAVE_SMTP
@@ -103,7 +103,7 @@
}
else
{
- AppenderSkeleton::setOption(name, value);
+ AppenderSkeleton::setOption(option, value);
}
}
1.9 +17 -17 logging-log4cxx/src/socketappender.cpp
Index: socketappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/socketappender.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- socketappender.cpp 22 Apr 2004 21:21:34 -0000 1.8
+++ socketappender.cpp 22 Oct 2004 07:47:58 -0000 1.9
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/net/socketappender.h>
#include <log4cxx/helpers/loglog.h>
#include <log4cxx/helpers/socketoutputstream.h>
@@ -36,13 +36,13 @@
SocketAppender::SocketAppender()
-: port(DEFAULT_PORT), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
+: port(DEFAULT_PORT), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
locationInfo(false)
{
}
SocketAppender::SocketAppender(unsigned long address, int port)
-: port(port), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
+: port(port), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
locationInfo(false)
{
this->address.address = address;
@@ -89,7 +89,7 @@
}
else
{
- AppenderSkeleton::setOption(name, value);
+ AppenderSkeleton::setOption(option, value);
}
}
@@ -118,17 +118,17 @@
{
LogLog::error(_T("Could not close socket :"), e);
}
-
+
os = 0;
}
-
+
if(connector != 0)
{
//LogLog::debug(_T("Interrupting the connector."));
connector->interrupted = true;
connector = 0;
}
-
+
}
void SocketAppender::connect()
@@ -137,12 +137,12 @@
{
return;
}
-
+
try
{
// First, close the previous connection if any.
cleanUp();
-
+
SocketPtr socket = new Socket(address, port);
os = socket->getOutputStream();
}
@@ -151,14 +151,14 @@
String msg = _T("Could not connect to remote log4cxx server at [")
+address.getHostName()+_T("].");
-
+
if(reconnectionDelay > 0)
{
msg += _T(" We will try again later. ");
}
fireConnector(); // fire the connector thread
-
+
LogLog::error(msg, e);
}
}
@@ -175,7 +175,7 @@
if(os != 0) try
{
-/*
+/*
if(locationInfo)
{
event.getLocationInformation();
@@ -227,7 +227,7 @@
LogLog::debug(_T("Attempting connection to ")
+socketAppender->address.getHostName());
socket = new Socket(socketAppender->address, socketAppender->port);
-
+
synchronized sync(this);
{
socketAppender->os = socket->getOutputStream();
@@ -254,6 +254,6 @@
+_T(". Exception is ") + e.getMessage());
}
}
-
+
LogLog::debug(_T("Exiting Connector.run() method."));
}
1.10 +28 -26 logging-log4cxx/src/sockethubappender.cpp
Index: sockethubappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/sockethubappender.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sockethubappender.cpp 30 May 2004 15:28:19 -0000 1.9
+++ sockethubappender.cpp 22 Oct 2004 07:47:58 -0000 1.10
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/net/sockethubappender.h>
#include <log4cxx/helpers/loglog.h>
@@ -66,7 +66,7 @@
}
else
{
- AppenderSkeleton::setOption(name, value);
+ AppenderSkeleton::setOption(option, value);
}
}
@@ -79,7 +79,7 @@
{
return;
}
-
+
LOGLOG_DEBUG(_T("closing SocketHubAppender ") << getName());
closed = true;
cleanUp();
@@ -90,9 +90,11 @@
{
// stop the monitor thread
LOGLOG_DEBUG(_T("stopping ServerSocket"));
- serverMonitor->stopMonitor();
+ if (NULL != (ServerMonitor*) serverMonitor) {
+ serverMonitor->stopMonitor();
+ }
serverMonitor = 0;
-
+
// close all of the connections
LOGLOG_DEBUG(_T("closing client connections"));
while (!oosList.empty())
@@ -108,8 +110,8 @@
{
LogLog::error(_T("could not close oos: "), e);
}
-
- oosList.erase(oosList.begin());
+
+ oosList.erase(oosList.begin());
}
}
}
@@ -122,27 +124,27 @@
{
return;
}
-
+
/* // set up location info if requested
if (locationInfo)
{
- event.getLocationInformation();
+ event.getLocationInformation();
} */
-
+
// loop through the current set of open connections, appending the event to each
std::vector<SocketOutputStreamPtr>::iterator it = oosList.begin();
std::vector<SocketOutputStreamPtr>::iterator itEnd = oosList.end();
while(it != itEnd)
- {
+ {
SocketOutputStreamPtr oos = *it;
-
+
// list size changed unexpectedly? Just exit the append.
if (oos == 0)
{
break;
}
-
- try
+
+ try
{
event->write(oos);
oos->flush();
@@ -174,18 +176,18 @@
synchronized sync(this);
if (keepRunning)
- {
+ {
LogLog::debug(_T("server monitor thread shutting down"));
keepRunning = false;
try
- {
+ {
monitorThread->join();
}
catch (InterruptedException&)
{
// do nothing?
}
-
+
// release the thread
monitorThread = 0;
LogLog::debug(_T("server monitor thread shut down"));
@@ -207,7 +209,7 @@
keepRunning = false;
return;
}
-
+
try
{
serverSocket->setSoTimeout(1000);
@@ -217,7 +219,7 @@
LogLog::error(_T("exception setting timeout, shutting down server socket."), e);
return;
}
-
+
while (keepRunning)
{
SocketPtr socket;
@@ -238,19 +240,19 @@
{
LogLog::error(_T("exception accepting socket."), e);
}
-
+
// if there was a socket accepted
if (socket != 0)
{
try
{
InetAddress remoteAddress = socket->getInetAddress();
- LOGLOG_DEBUG(_T("accepting connection from ") << remoteAddress.getHostName()
+ LOGLOG_DEBUG(_T("accepting connection from ") << remoteAddress.getHostName()
<< _T(" (") + remoteAddress.getHostAddress() + _T(")"));
-
+
// create an ObjectOutputStream
SocketOutputStreamPtr oos = socket->getOutputStream();
-
+
// add it to the oosList. OK since Vector is synchronized.
oosList.push_back(oos);
}
1.10 +15 -15 logging-log4cxx/src/syslogappender.cpp
Index: syslogappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/syslogappender.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- syslogappender.cpp 13 Aug 2004 12:27:48 -0000 1.9
+++ syslogappender.cpp 22 Oct 2004 07:47:58 -0000 1.10
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/net/syslogappender.h>
#include <log4cxx/helpers/loglog.h>
#include <log4cxx/helpers/stringhelper.h>
@@ -22,7 +22,7 @@
#include <log4cxx/level.h>
#ifdef LOG4CXX_HAVE_SYSLOG
- #include <syslog.h>
+ #include <syslog.h>
#else
/* facility codes */
#define LOG_KERN (0<<3) /* kernel messages */
@@ -37,7 +37,7 @@
#define LOG_CRON (9<<3) /* clock daemon */
#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
#define LOG_FTP (11<<3) /* ftp daemon */
-
+
/* other codes through 15 reserved for system use */
#define LOG_LOCAL0 (16<<3) /* reserved for local use */
#define LOG_LOCAL1 (17<<3) /* reserved for local use */
@@ -253,17 +253,17 @@
// On the local host, we can directly use the system function 'syslog'
// if it is available
-#ifdef LOG4CXX_HAVE_SYSLOG
+#ifdef LOG4CXX_HAVE_SYSLOG
if (sw == 0)
{
StringBuffer sbuf;
layout->format(sbuf, event);
USES_CONVERSION;
-
+
// use of "%s" to avoid a security hole
- ::syslog(syslogFacility | event->getLevel()->getSyslogEquivalent(),
+ ::syslog(syslogFacility | event->getLevel()->getSyslogEquivalent(),
"%s", T2A(sbuf.str().c_str()));
-
+
return;
}
#endif
@@ -304,7 +304,7 @@
}
else
{
- AppenderSkeleton::setOption(name, value);
+ AppenderSkeleton::setOption(option, value);
}
}
@@ -315,15 +315,15 @@
delete this->sw;
this->sw = 0;
}
-
+
// On the local host, we can directly use the system function 'syslog'
// if it is available (cf. append)
-#ifdef LOG4CXX_HAVE_SYSLOG
+#ifdef LOG4CXX_HAVE_SYSLOG
if (syslogHost != _T("localhost") && syslogHost != _T("127.0.0.1")
&& !syslogHost.empty())
-#endif
+#endif
this->sw = new SyslogWriter(syslogHost);
-
+
this->syslogHost = syslogHost;
}
1.9 +15 -15 logging-log4cxx/src/telnetappender.cpp
Index: telnetappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/telnetappender.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- telnetappender.cpp 22 Apr 2004 21:21:34 -0000 1.8
+++ telnetappender.cpp 22 Oct 2004 07:47:58 -0000 1.9
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <log4cxx/net/telnetappender.h>
#include <log4cxx/helpers/loglog.h>
#include <log4cxx/helpers/socketoutputstream.h>
@@ -38,9 +38,9 @@
finalize();
}
-void TelnetAppender::activateOptions()
+void TelnetAppender::activateOptions()
{
- try
+ try
{
sh = new SocketHandler(port);
sh->start();
@@ -60,11 +60,11 @@
}
else
{
- AppenderSkeleton::setOption(name, value);
+ AppenderSkeleton::setOption(option, value);
}
}
-void TelnetAppender::close()
+void TelnetAppender::close()
{
if (sh != 0)
{
@@ -72,7 +72,7 @@
}
}
-void TelnetAppender::append(const spi::LoggingEventPtr& event)
+void TelnetAppender::append(const spi::LoggingEventPtr& event)
{
if (sh != 0)
{
@@ -95,7 +95,7 @@
for (it = connections.begin(); it != itEnd; it++)
{
- try
+ try
{
(*it)->close();
}
@@ -107,7 +107,7 @@
try
{
serverSocket.close();
- }
+ }
catch(Exception&)
{
}
@@ -154,7 +154,7 @@
{
while(!done)
{
- try
+ try
{
SocketPtr newClient = serverSocket.accept();
SocketOutputStreamPtr os = newClient->getOutputStream();
@@ -168,15 +168,15 @@
<< _T(" active connections)\r\n\r\n");
print(os, oss.str());
os->flush();
- }
+ }
else
{
print(os, _T("Too many connections.\r\n"));
os->flush();
newClient->close();
}
- }
- catch(Exception& e)
+ }
+ catch(Exception& e)
{
LogLog::error(_T("Encountered error while in SocketHandler loop."), e);
}
1.9 +15 -15 logging-log4cxx/src/xmlsocketappender.cpp
Index: xmlsocketappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/xmlsocketappender.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- xmlsocketappender.cpp 4 Aug 2004 05:29:26 -0000 1.8
+++ xmlsocketappender.cpp 22 Oct 2004 07:47:58 -0000 1.9
@@ -1,12 +1,12 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,7 +39,7 @@
const int XMLSocketAppender::MAX_EVENT_LEN = 1024;
XMLSocketAppender::XMLSocketAppender()
-: port(DEFAULT_PORT), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
+: port(DEFAULT_PORT), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
locationInfo(false), connector(0)
{
layout = new XMLLayout();
@@ -47,7 +47,7 @@
}
XMLSocketAppender::XMLSocketAppender(unsigned long address, int port)
-: port(port), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
+: port(port), reconnectionDelay(DEFAULT_RECONNECTION_DELAY),
locationInfo(false), connector(0)
{
layout = new XMLLayout();
@@ -100,7 +100,7 @@
}
else
{
- AppenderSkeleton::setOption(name, value);
+ AppenderSkeleton::setOption(option, value);
}
}
@@ -129,17 +129,17 @@
{
LogLog::error(_T("Could not close socket :"), e);
}
-
+
os = 0;
}
-
+
if(connector != 0)
{
//LogLog::debug(_T("Interrupting the connector."));
connector->interrupted = true;
connector = 0;
}
-
+
}
void XMLSocketAppender::connect()
@@ -148,12 +148,12 @@
{
return;
}
-
+
try
{
// First, close the previous connection if any.
cleanUp();
-
+
SocketPtr socket = new Socket(address, port);
os = socket->getOutputStream();
}
@@ -162,14 +162,14 @@
String msg = _T("Could not connect to remote log4cxx server at [")
+address.getHostName()+_T("].");
-
+
if(reconnectionDelay > 0)
{
msg += _T(" We will try again later. ");
}
fireConnector(); // fire the connector thread
-
+
LogLog::error(msg, e);
}
}
@@ -243,7 +243,7 @@
LogLog::debug(_T("Attempting connection to ")
+socketAppender->address.getHostName());
socket = new Socket(socketAppender->address, socketAppender->port);
-
+
synchronized sync(this);
{
socketAppender->os = socket->getOutputStream();
@@ -270,6 +270,6 @@
+_T(". Exception is ") + e.getMessage());
}
}
-
+
LogLog::debug(_T("Exiting Connector.run() method."));
}
1.7 +19 -8 logging-log4cxx/tests/src/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Makefile.am 10 Apr 2004 21:50:28 -0000 1.6
+++ Makefile.am 22 Oct 2004 07:47:59 -0000 1.7
@@ -17,11 +17,18 @@
main.cpp\
minimumtestcase.cpp\
patternlayouttest.cpp\
- vectorappender.cpp
+ vectorappender.cpp\
+ appenderskeletontestcase.cpp\
+ consoleappendertestcase.cpp\
+ dailyrollingfileappendertestcase.cpp\
+ fileappendertestcase.cpp\
+ rollingfileappendertestcase.cpp\
+ writerappendertestcase.cpp
+
testsuite_LDADD = \
$(top_builddir)/src/liblog4cxx.la
-
+
testsuite_LDFLAGS = \
-Wl,--whole-archive,customlogger/libcustomlogger.a,--no-whole-archive\
-Wl,--whole-archive,defaultinit/libdefaultinit.a,--no-whole-archive\
@@ -31,10 +38,12 @@
-Wl,--whole-archive,util/libutil.a,--no-whole-archive\
-Wl,--whole-archive,varia/libvaria.a,--no-whole-archive\
-Wl,--whole-archive,xml/libxml.a,--no-whole-archive\
+ -Wl,--whole-archive,xml/libdb.a,--no-whole-archive\
+ -Wl,--whole-archive,xml/libnt.a,--no-whole-archive\
@LIBS_CPPUNIT@ -lboost_regex
-
+
AM_CPPFLAGS = @CPPFLAGS_CPPUNIT@
-
+
testsuite_DEPENDENCIES = \
customlogger/libcustomlogger.a\
defaultinit/libdefaultinit.a\
@@ -44,14 +53,16 @@
util/libutil.a\
varia/libvaria.a\
xml/libxml.a\
+ db/libdb.a\
+ nt/libnt.a\
$(top_builddir)/src/liblog4cxx.la
-
+
shortsocketserver_SOURCES = \
shortsocketserver.cpp
-
+
shortsocketserver_LDADD = \
$(top_builddir)/src/liblog4cxx.la
-
+
shortsocketserver_LDFLAGS = \
-Wl,--whole-archive,util/libutil.a,--no-whole-archive\
-Wl,--whole-archive,xml/libxml.a,--no-whole-archive\
@@ -61,6 +72,6 @@
util/libutil.a\
xml/libxml.a\
$(top_builddir)/src/liblog4cxx.la
-
+
check: testsuite shortsocketserver
endif
1.5 +19 -5 logging-log4cxx/tests/src/asyncappendertestcase.cpp
Index: asyncappendertestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/asyncappendertestcase.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- asyncappendertestcase.cpp 22 Apr 2004 21:21:36 -0000 1.4
+++ asyncappendertestcase.cpp 22 Oct 2004 07:47:59 -0000 1.5
@@ -1,12 +1,12 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,6 +22,7 @@
#include <log4cxx/simplelayout.h>
#include "vectorappender.h"
#include <log4cxx/asyncappender.h>
+#include "appenderskeletontestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -29,9 +30,15 @@
/**
A superficial but general test of log4j.
*/
-class AsyncAppenderTestCase : public CppUnit::TestFixture
+class AsyncAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(AsyncAppenderTestCase);
+ //
+ // tests inherited from AppenderSkeletonTestCase
+ //
+ CPPUNIT_TEST(testDefaultThreshold);
+ CPPUNIT_TEST(testSetOptionThreshold);
+
CPPUNIT_TEST(closeTest);
CPPUNIT_TEST(test2);
CPPUNIT_TEST(test3);
@@ -39,12 +46,19 @@
public:
- void setUp() {}
+ void setUp() {
+ AppenderSkeletonTestCase::setUp();
+ }
void tearDown()
{
LogManager::shutdown();
+ AppenderSkeletonTestCase::tearDown();
}
+
+ AppenderSkeleton* createAppenderSkeleton() const {
+ return new AsyncAppender();
+ }
// this test checks whether it is possible to write to a closed AsyncAppender
void closeTest() throw(Exception)
1.1 logging-log4cxx/tests/src/appenderskeletontestcase.cpp
Index: appenderskeletontestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "appenderskeletontestcase.h"
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/helpers/objectptr.h>
#include <log4cxx/appenderskeleton.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
void AppenderSkeletonTestCase::testDefaultThreshold() {
ObjectPtrT<AppenderSkeleton> appender(createAppenderSkeleton());
LevelPtr threshold(appender->getThreshold());
CPPUNIT_ASSERT_EQUAL(Level::ALL->toInt(), threshold->toInt());
}
void AppenderSkeletonTestCase::testSetOptionThreshold() {
ObjectPtrT<AppenderSkeleton> appender(createAppenderSkeleton());
appender->setOption("threshold", "debug");
LevelPtr threshold(appender->getThreshold());
CPPUNIT_ASSERT_EQUAL(Level::DEBUG->toInt(), threshold->toInt());
}
1.1 logging-log4cxx/tests/src/appenderskeletontestcase.h
Index: appenderskeletontestcase.h
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <log4cxx/appenderskeleton.h>
/**
An abstract set of tests for inclusion in concrete
appender test case
*/
class AppenderSkeletonTestCase : public CppUnit::TestFixture
{
public:
virtual log4cxx::AppenderSkeleton* createAppenderSkeleton() const = 0;
void testDefaultThreshold();
void testSetOptionThreshold();
};
1.1 logging-log4cxx/tests/src/consoleappendertestcase.cpp
Index: consoleappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/consoleappender.h>
#include "writerappendertestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::nt::NTEventLogAppender
*/
class ConsoleAppenderTestCase : public WriterAppenderTestCase
{
CPPUNIT_TEST_SUITE(ConsoleAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
WriterAppender* createWriterAppender() const {
return new log4cxx::ConsoleAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(ConsoleAppenderTestCase);
1.1 logging-log4cxx/tests/src/dailyrollingfileappendertestcase.cpp
Index: dailyrollingfileappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/dailyrollingfileappender.h>
#include "fileappendertestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::DailyRollingFileAppender
*/
class DailyRollingFileAppenderTestCase : public FileAppenderTestCase
{
CPPUNIT_TEST_SUITE(DailyRollingFileAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
FileAppender* createFileAppender() const {
return new log4cxx::DailyRollingFileAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(DailyRollingFileAppenderTestCase);
1.1 logging-log4cxx/tests/src/fileappendertestcase.cpp
Index: fileappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "fileappendertestcase.h"
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/helpers/objectptr.h>
#include <log4cxx/fileappender.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
WriterAppender* FileAppenderTestCase::createWriterAppender() const {
return createFileAppender();
}
1.1 logging-log4cxx/tests/src/fileappendertestcase.h
Index: fileappendertestcase.h
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <log4cxx/fileappender.h>
#include "writerappendertestcase.h"
/**
An abstract set of tests for inclusion in concrete
appender test case
*/
class FileAppenderTestCase : public WriterAppenderTestCase
{
public:
log4cxx::WriterAppender* createWriterAppender() const;
virtual log4cxx::FileAppender* createFileAppender() const = 0;
};
1.1 logging-log4cxx/tests/src/rollingfileappendertestcase.cpp
Index: rollingfileappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/rollingfileappender.h>
#include "fileappendertestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::RollingFileAppender
*/
class RollingFileAppenderTestCase : public FileAppenderTestCase
{
CPPUNIT_TEST_SUITE(RollingFileAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
FileAppender* createFileAppender() const {
return new log4cxx::RollingFileAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(RollingFileAppenderTestCase);
1.1 logging-log4cxx/tests/src/writerappendertestcase.cpp
Index: writerappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "writerappendertestcase.h"
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/helpers/objectptr.h>
#include <log4cxx/writerappender.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
AppenderSkeleton* WriterAppenderTestCase::createAppenderSkeleton() const {
return createWriterAppender();
}
1.1 logging-log4cxx/tests/src/writerappendertestcase.h
Index: writerappendertestcase.h
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <log4cxx/writerappender.h>
#include "appenderskeletontestcase.h"
/**
An abstract set of tests for inclusion in concrete
appender test case
*/
class WriterAppenderTestCase : public AppenderSkeletonTestCase
{
public:
log4cxx::AppenderSkeleton* createAppenderSkeleton() const;
virtual log4cxx::WriterAppender* createWriterAppender() const = 0;
};
1.1 logging-log4cxx/tests/src/db/Makefile.am
Index: Makefile.am
===================================================================
EXTRA_DIST = $(top_srcdir)/tests/src/db/*.cpp
noinst_HEADERS= $(top_srcdir)/tests/src/db/*.h
if TESTS
noinst_LIBRARIES = libdb.a
INCLUDES = -I$(top_srcdir)/include
libnet_a_SOURCES = \
socketservertestcase.cpp
check: libdb.a
endif
1.1 logging-log4cxx/tests/src/db/odbcappendertestcase.cpp
Index: odbcappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/db/odbcappender.h>
#include "../appenderskeletontestcase.h"
#ifdef LOG4CXX_HAVE_ODBC
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::SocketAppender
*/
class ODBCAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(ODBCAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::db::ODBCAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(ODBCAppenderTestCase);
#endif
1.1 logging-log4cxx/tests/src/net/smtpappendertestcase.cpp
Index: smtpappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/net/smtpappender.h>
#include "../appenderskeletontestcase.h"
#ifdef LOG4CXX_HAVE_SMTP
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::SocketAppender
*/
class SMTPAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(SMTPAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::net::SMTPAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(SMTPAppenderTestCase);
#endif
1.1 logging-log4cxx/tests/src/net/socketappendertestcase.cpp
Index: socketappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/net/socketappender.h>
#include "../appenderskeletontestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::SocketAppender
*/
class SocketAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(SocketAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::net::SocketAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(SocketAppenderTestCase);
1.1 logging-log4cxx/tests/src/net/sockethubappendertestcase.cpp
Index: sockethubappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/net/sockethubappender.h>
#include "../appenderskeletontestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::SocketHubAppender
*/
class SocketHubAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(SocketHubAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::net::SocketHubAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(SocketHubAppenderTestCase);
1.1 logging-log4cxx/tests/src/net/syslogappendertestcase.cpp
Index: syslogappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/net/syslogappender.h>
#include "../appenderskeletontestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::SyslogAppender
*/
class SyslogAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(SyslogAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::net::SyslogAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(SyslogAppenderTestCase);
1.1 logging-log4cxx/tests/src/net/telnetappendertestcase.cpp
Index: telnetappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/net/telnetappender.h>
#include "../appenderskeletontestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::TelnetAppender
*/
class TelnetAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(TelnetAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::net::TelnetAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TelnetAppenderTestCase);
1.1 logging-log4cxx/tests/src/net/xmlsocketappendertestcase.cpp
Index: xmlsocketappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/net/xmlsocketappender.h>
#include "../appenderskeletontestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::net::XMLSocketAppender
*/
class XMLSocketAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(XMLSocketAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::net::XMLSocketAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(XMLSocketAppenderTestCase);
1.1 logging-log4cxx/tests/src/nt/Makefile.am
Index: Makefile.am
===================================================================
EXTRA_DIST = $(top_srcdir)/tests/src/nt/*.cpp
noinst_HEADERS= $(top_srcdir)/tests/src/nt/*.h
if TESTS
noinst_LIBRARIES = libnt.a
INCLUDES = -I$(top_srcdir)/include
libnet_a_SOURCES = \
socketservertestcase.cpp
check: libnt.a
endif
1.1 logging-log4cxx/tests/src/nt/nteventlogappendertestcase.cpp
Index: nteventlogappendertestcase.cpp
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(_WIN32)
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/nt/nteventlogappender.h>
#include "../appenderskeletontestcase.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
/**
Unit tests of log4cxx::nt::NTEventLogAppender
*/
class NTEventLogAppenderTestCase : public AppenderSkeletonTestCase
{
CPPUNIT_TEST_SUITE(NTEventLogAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
CPPUNIT_TEST(testDefaultThreshold);
CPPUNIT_TEST(testSetOptionThreshold);
CPPUNIT_TEST_SUITE_END();
public:
AppenderSkeleton* createAppenderSkeleton() const {
return new log4cxx::nt::NTEventLogAppender();
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(NTEventLogAppenderTestCase);
#endif