You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2021/11/06 00:43:10 UTC
[logging-log4cxx] 05/20: Removed TTCCLayout and DateLayout
This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch LOGCXX-510
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit 1e294eab856d47aa595d0505f80f1be0316254ab
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sun Oct 31 12:00:13 2021 -0400
Removed TTCCLayout and DateLayout
---
src/main/cpp/CMakeLists.txt | 2 -
src/main/cpp/class.cpp | 3 -
src/main/cpp/datelayout.cpp | 127 ----------------
src/main/cpp/ttcclayout.cpp | 79 ----------
src/main/include/log4cxx/helpers/datelayout.h | 108 --------------
src/main/include/log4cxx/ttcclayout.h | 206 --------------------------
src/test/cpp/CMakeLists.txt | 2 +
src/test/cpp/minimumtestcase.cpp | 46 ------
src/test/cpp/net/telnetappendertestcase.cpp | 13 +-
src/test/resources/witness/ttcc | 25 ----
10 files changed, 11 insertions(+), 600 deletions(-)
diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt
index c83217b..dd8ce88 100644
--- a/src/main/cpp/CMakeLists.txt
+++ b/src/main/cpp/CMakeLists.txt
@@ -37,7 +37,6 @@ target_sources(log4cxx
datagramsocket.cpp
date.cpp
dateformat.cpp
- datelayout.cpp
datepatternconverter.cpp
defaultconfigurator.cpp
defaultloggerfactory.cpp
@@ -152,7 +151,6 @@ target_sources(log4cxx
transcoder.cpp
transform.cpp
triggeringpolicy.cpp
- ttcclayout.cpp
writer.cpp
writerappender.cpp
xmllayout.cpp
diff --git a/src/main/cpp/class.cpp b/src/main/cpp/class.cpp
index 80430f7..13adbf2 100644
--- a/src/main/cpp/class.cpp
+++ b/src/main/cpp/class.cpp
@@ -55,7 +55,6 @@
#include <log4cxx/htmllayout.h>
#include <log4cxx/simplelayout.h>
#include <log4cxx/xml/xmllayout.h>
-#include <log4cxx/ttcclayout.h>
#include <log4cxx/filter/levelmatchfilter.h>
#include <log4cxx/filter/levelrangefilter.h>
@@ -181,11 +180,9 @@ void Class::registerClasses()
TelnetAppender::registerClass();
#endif
XMLSocketAppender::registerClass();
- DateLayout::registerClass();
HTMLLayout::registerClass();
PatternLayout::registerClass();
SimpleLayout::registerClass();
- TTCCLayout::registerClass();
XMLLayout::registerClass();
LevelMatchFilter::registerClass();
LevelRangeFilter::registerClass();
diff --git a/src/main/cpp/datelayout.cpp b/src/main/cpp/datelayout.cpp
deleted file mode 100644
index eb0f6ff..0000000
--- a/src/main/cpp/datelayout.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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/logstring.h>
-#include <log4cxx/helpers/datelayout.h>
-#include <log4cxx/helpers/stringhelper.h>
-#include <log4cxx/spi/loggingevent.h>
-#include <log4cxx/helpers/dateformat.h>
-#include <log4cxx/helpers/relativetimedateformat.h>
-#include <log4cxx/helpers/absolutetimedateformat.h>
-#include <log4cxx/helpers/datetimedateformat.h>
-#include <log4cxx/helpers/iso8601dateformat.h>
-#include <log4cxx/helpers/timezone.h>
-
-using namespace log4cxx;
-using namespace log4cxx::helpers;
-using namespace log4cxx::spi;
-
-DateLayout::DateLayout(const LogString& dateFormatOption1) :
- timeZoneID(), dateFormatOption(dateFormatOption1), dateFormat(0)
-{
-}
-
-DateLayout::~DateLayout()
-{
-}
-
-
-void DateLayout::setOption(const LogString& option, const LogString& value)
-{
-
- if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("DATEFORMAT"), LOG4CXX_STR("dateformat")))
- {
- dateFormatOption = value;
- }
- else if (StringHelper::equalsIgnoreCase(option,
- LOG4CXX_STR("TIMEZONE"), LOG4CXX_STR("timezone")))
- {
- timeZoneID = value;
- }
-}
-
-void DateLayout::activateOptions(Pool&)
-{
- if (!dateFormatOption.empty())
- {
-
- if (dateFormatOption.empty())
- {
- dateFormat = 0;
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("NULL"), LOG4CXX_STR("null")))
- {
- dateFormat = 0;
- dateFormatOption = LOG4CXX_STR("NULL");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("RELATIVE"), LOG4CXX_STR("relative")))
- {
- dateFormat = DateFormatPtr(new RelativeTimeDateFormat());
- dateFormatOption = LOG4CXX_STR("RELATIVE");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("ABSOLUTE"), LOG4CXX_STR("absolute")))
- {
- dateFormat = DateFormatPtr(new AbsoluteTimeDateFormat());
- dateFormatOption = LOG4CXX_STR("ABSOLUTE");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("DATE"), LOG4CXX_STR("date")))
- {
- dateFormat = DateFormatPtr(new DateTimeDateFormat());
- dateFormatOption = LOG4CXX_STR("DATE");
- }
- else if (StringHelper::equalsIgnoreCase(dateFormatOption,
- LOG4CXX_STR("ISO8601"), LOG4CXX_STR("iso8601")))
- {
- dateFormat = DateFormatPtr(new ISO8601DateFormat());
- dateFormatOption = LOG4CXX_STR("iso8601");
- }
- else
- {
- dateFormat = DateFormatPtr(new SimpleDateFormat(dateFormatOption));
- }
- }
-
- if (dateFormat != NULL)
- {
- if (timeZoneID.empty())
- {
- dateFormat->setTimeZone(TimeZone::getDefault());
- }
- else
- {
- dateFormat->setTimeZone(TimeZone::getTimeZone(timeZoneID));
- }
- }
-}
-
-
-void DateLayout::formatDate(LogString& s,
- const spi::LoggingEventPtr& event,
- Pool& p) const
-{
-
- if (dateFormat != 0)
- {
- dateFormat->format(s, event->getTimeStamp(), p);
- s.append(1, (logchar) 0x20 /* ' ' */);
- }
-}
-
diff --git a/src/main/cpp/ttcclayout.cpp b/src/main/cpp/ttcclayout.cpp
deleted file mode 100644
index 4a291a8..0000000
--- a/src/main/cpp/ttcclayout.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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/logstring.h>
-#include <log4cxx/ttcclayout.h>
-#include <log4cxx/spi/loggingevent.h>
-#include <log4cxx/level.h>
-#include <log4cxx/helpers/stringhelper.h>
-#include <log4cxx/ndc.h>
-
-using namespace log4cxx;
-using namespace log4cxx::spi;
-using namespace log4cxx::helpers;
-
-IMPLEMENT_LOG4CXX_OBJECT(TTCCLayout)
-
-TTCCLayout::TTCCLayout()
- : DateLayout(LOG4CXX_STR("RELATIVE")), threadPrinting(true), categoryPrefixing(true),
- contextPrinting(true), filePrinting(false)
-{
- Pool pool;
- activateOptions(pool);
-}
-
-TTCCLayout::TTCCLayout(const LogString& dateFormatType)
- : DateLayout(dateFormatType), threadPrinting(true), categoryPrefixing(true),
- contextPrinting(true), filePrinting(false)
-{
- Pool pool;
- activateOptions(pool);
-}
-
-void TTCCLayout::format(LogString& output,
- const spi::LoggingEventPtr& event,
- Pool& p) const
-{
- formatDate(output, event, p);
-
- if (threadPrinting)
- {
- output.append(1, (logchar) 0x5B /* '[' */);
- output.append(event->getThreadName());
- output.append(1, (logchar) 0x5D /* ']' */);
- output.append(1, (logchar) 0x20 /* ' ' */);
- }
-
- output.append(event->getLevel()->toString());
- output.append(1, (logchar) 0x20 /* ' ' */);
-
- if (categoryPrefixing)
- {
- output.append(event->getLoggerName());
- output.append(1, (logchar) 0x20 /* ' ' */);
- }
-
- if (contextPrinting && event->getNDC(output))
- {
- output.append(1, (logchar) 0x20 /* ' ' */);
- }
-
- output.append(1, (logchar) 0x2D /* '-' */);
- output.append(1, (logchar) 0x20 /* ' ' */);
- output.append(event->getRenderedMessage());
- output.append(LOG4CXX_EOL);
-}
diff --git a/src/main/include/log4cxx/helpers/datelayout.h b/src/main/include/log4cxx/helpers/datelayout.h
deleted file mode 100644
index 744c881..0000000
--- a/src/main/include/log4cxx/helpers/datelayout.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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_DATE_LAYOUT_H
-#define _LOG4CXX_HELPERS_DATE_LAYOUT_H
-
-#include <log4cxx/layout.h>
-#include <log4cxx/helpers/dateformat.h>
-#include <log4cxx/helpers/timezone.h>
-
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
-namespace log4cxx
-{
-namespace helpers
-{
-/**
-This abstract layout takes care of all the date related options and
-formatting work.
-*/
-class LOG4CXX_EXPORT DateLayout : public Layout
-{
- private:
- LogString timeZoneID;
- LogString dateFormatOption;
-
- protected:
- DateFormatPtr dateFormat;
-
- public:
- DateLayout(const LogString& dateLayoutOption);
- virtual ~DateLayout();
-
- virtual void activateOptions(log4cxx::helpers::Pool& p);
- virtual void setOption(const LogString& option, const LogString& value);
-
- /**
- The value of the <b>DateFormat</b> option should be either an
- argument to the constructor of helpers::DateFormat or one of
- the strings <b>"NULL"</b>, <b>"RELATIVE"</b>, <b>"ABSOLUTE"</b>,
- <b>"DATE"</b> or <b>"ISO8601</b>.
- */
- inline void setDateFormat(const LogString& dateFormat1)
- {
- this->dateFormatOption.assign(dateFormat1);
- }
-
- /**
- Returns value of the <b>DateFormat</b> option.
- */
- inline const LogString& getDateFormat() const
- {
- return dateFormatOption;
- }
-
- /**
- The <b>TimeZoneID</b> option is a time zone ID string in the format
- expected by the <code>locale</code> C++ standard class.
- */
- inline void setTimeZone(const LogString& timeZone)
- {
- this->timeZoneID.assign(timeZone);
- }
-
- /**
- Returns value of the <b>TimeZone</b> option.
- */
- inline const LogString& getTimeZone() const
- {
- return timeZoneID;
- }
-
- void formatDate(LogString& s,
- const spi::LoggingEventPtr& event,
- log4cxx::helpers::Pool& p) const;
-
- private:
- //
- // prevent copy and assignment
- DateLayout(const DateLayout&);
- DateLayout& operator=(const DateLayout&);
-
-};
-} // namespace helpers
-} // namespace log4cxx
-
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
-#endif // _LOG4CXX_HELPERS_DATE_LAYOUT_H
diff --git a/src/main/include/log4cxx/ttcclayout.h b/src/main/include/log4cxx/ttcclayout.h
deleted file mode 100644
index 4f9a810..0000000
--- a/src/main/include/log4cxx/ttcclayout.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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_TTCC_LAYOUT_H
-#define _LOG4CXX_TTCC_LAYOUT_H
-
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-#include <log4cxx/helpers/datelayout.h>
-
-namespace log4cxx
-{
-
-/**
-TTCC layout format consists of time, thread, logger name and nested
-diagnostic context information, hence the name.
-
-<p>Each of the four fields can be individually enabled or
-disabled. The time format depends on the <code>DateFormat</code>
-used.
-
-<p>Here is an example TTCCLayout output with the
-{@link helpers::RelativeTimeDateFormat RelativeTimeDateFormat}.
-
-<pre>
-176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
-225 [main] INFO examples.SortAlgo - Entered the sort method.
-262 [main] DEBUG examples.SortAlgo.OUTER i=1 - Outer loop.
-276 [main] DEBUG examples.SortAlgo.SWAP i=1 j=0 - Swapping intArray[0] = 1 and intArray[1] = 0
-290 [main] DEBUG examples.SortAlgo.OUTER i=0 - Outer loop.
-304 [main] INFO examples.SortAlgo.DUMP - Dump of interger array:
-317 [main] INFO examples.SortAlgo.DUMP - Element [0] = 0
-331 [main] INFO examples.SortAlgo.DUMP - Element [1] = 1
-343 [main] INFO examples.Sort - The next log statement should be an error message.
-346 [main] ERROR examples.SortAlgo.DUMP - Tried to dump an uninitialized array.
-467 [main] INFO examples.Sort - Exiting main method.
-</pre>
-
-<p>The first field is the number of milliseconds elapsed since the
-start of the program. The second field is the thread outputting the
-log statement. The third field is the level, the fourth field is
-the logger to which the statement belongs.
-
-<p>The fifth field (just before the '-') is the nested diagnostic
-context. Note the nested diagnostic context may be empty as in the
-first two statements. The text after the '-' is the message of the
-statement.
-
-<p><b>WARNING</b> Do not use the same TTCCLayout instance from
-within different appenders. The TTCCLayout is not thread safe when
-used in his way. However, it is perfectly safe to use a TTCCLayout
-instance from just one appender.
-
-<p>PatternLayout offers a much more flexible alternative.
-*/
-class LOG4CXX_EXPORT TTCCLayout : public helpers::DateLayout
-{
- private:
- // Internal representation of options
- bool threadPrinting;
- bool categoryPrefixing;
- bool contextPrinting;
- bool filePrinting;
-
- public:
- DECLARE_LOG4CXX_OBJECT(TTCCLayout)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(TTCCLayout)
- LOG4CXX_CAST_ENTRY_CHAIN(Layout)
- END_LOG4CXX_CAST_MAP()
-
- /**
- Instantiate a TTCCLayout object with {@link
- helpers::RelativeTimeDateFormat RelativeTimeDateFormat} as the date
- formatter in the local time zone.
- */
- TTCCLayout();
-
- /**
- Instantiate a TTCCLayout object using the local time zone. The
- DateFormat used will depend on the <code>dateFormatType</code>.
- <p>This constructor just calls the {@link
- helpers::DateLayout#setDateFormat DateLayout::setDateFormat} method.
- */
- TTCCLayout(const LogString& dateFormatType);
-
- /**
- The <b>ThreadPrinting</b> option specifies whether the name of the
- current thread is part of log output or not. This is true by default.
- */
- inline void setThreadPrinting(bool threadPrinting1)
- {
- this->threadPrinting = threadPrinting1;
- }
-
- /**
- Returns value of the <b>ThreadPrinting</b> option.
- */
- inline bool getThreadPrinting() const
- {
- return threadPrinting;
- }
-
- /**
- The <b>CategoryPrefixing</b> option specifies whether Logger
- name is part of log output or not. This is true by default.
- */
- inline void setCategoryPrefixing(bool categoryPrefixing1)
- {
- this->categoryPrefixing = categoryPrefixing1;
- }
-
- /**
- Returns value of the <b>CategoryPrefixing</b> option.
- */
- inline bool getCategoryPrefixing() const
- {
- return categoryPrefixing;
- }
-
- /**
- The <b>ContextPrinting</b> option specifies log output will include
- the nested context information belonging to the current thread.
- This is true by default.
- */
- inline void setContextPrinting(bool contextPrinting1)
- {
- this->contextPrinting = contextPrinting1;
- }
-
- /**
- Returns value of the <b>ContextPrinting</b> option.
- */
- inline bool getContextPrinting() const
- {
- return contextPrinting;
- }
-
- /**
- The <b>FilePrinting</b> option specifies log output will include
- the file and the line where the log statement was written.
- */
- inline void setFilePrinting(bool filePrinting1)
- {
- this->filePrinting = filePrinting1;
- }
-
- /**
- Returns value of the <b>ContextPrinting</b> option.
- */
- inline bool getFilePrinting() const
- {
- return filePrinting;
- }
-
- /**
- In addition to the level of the statement and message, this function
- writes to the ouput stream time, thread, logger and NDC
- information.
-
- <p>Time, thread, logger and diagnostic context are printed
- depending on options.
-
- @param output destination to receive formatted output.
- @param event event to format.
- @param pool pool used to allocate memory needed during formatting.
- */
- virtual void format(LogString& output,
- const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const;
-
- /**
- The TTCCLayout does not handle the throwable contained within
- {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
- <code>true</code>.
- */
- virtual bool ignoresThrowable() const
- {
- return true;
- }
-};
-LOG4CXX_PTR_DEF(TTCCLayout);
-}
-
-
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
-#endif
diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt
index b12db30..29413d9 100644
--- a/src/test/cpp/CMakeLists.txt
+++ b/src/test/cpp/CMakeLists.txt
@@ -118,3 +118,5 @@ foreach(testName IN LISTS ALL_LOG4CXX_TESTS)
endif()
endif()
endforeach()
+
+target_link_libraries(streamtestcase PRIVATE )
diff --git a/src/test/cpp/minimumtestcase.cpp b/src/test/cpp/minimumtestcase.cpp
index 8d171e0..4bb087d 100644
--- a/src/test/cpp/minimumtestcase.cpp
+++ b/src/test/cpp/minimumtestcase.cpp
@@ -17,7 +17,6 @@
#include "logunit.h"
#include <log4cxx/logger.h>
#include <log4cxx/simplelayout.h>
-#include <log4cxx/ttcclayout.h>
#include <log4cxx/fileappender.h>
#include <log4cxx/helpers/absolutetimedateformat.h>
@@ -39,22 +38,10 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-
-#define TTCC_PAT \
- ABSOLUTE_DATE_AND_TIME_PAT \
- " \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message [0-9]\\{1,2\\}"
-
-#define TTCC2_PAT \
- ABSOLUTE_DATE_AND_TIME_PAT \
- " \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - " \
- "Messages should bear numbers 0 through 23\\."
-
-
LOGUNIT_CLASS(MinimumTestCase)
{
LOGUNIT_TEST_SUITE(MinimumTestCase);
LOGUNIT_TEST(simple);
- LOGUNIT_TEST(ttcc);
LOGUNIT_TEST_SUITE_END();
public:
@@ -82,39 +69,6 @@ public:
LOGUNIT_ASSERT(Compare::compare(LOG4CXX_FILE("output/simple"), LOG4CXX_FILE("witness/simple")));
}
- void ttcc()
- {
- LayoutPtr layout = TTCCLayoutPtr(
- new TTCCLayout(LOG4CXX_STR("DATE")));
- AppenderPtr appender = FileAppenderPtr(new FileAppender(layout, LOG4CXX_STR("output/ttcc"), false));
- root->addAppender(appender);
- common();
-
- ControlFilter filter1;
- filter1 << TTCC_PAT << TTCC2_PAT;
- AbsoluteDateAndTimeFilter filter2;
- ThreadFilter filter3;
-
- std::vector<Filter*> filters;
- filters.push_back(&filter1);
- filters.push_back(&filter2);
- filters.push_back(&filter3);
-
- try
- {
- const File output("output/ttcc");
- Transformer::transform(output, FILTERED, filters);
- }
- catch (std::exception& e)
- {
- std::cout << "UnexpectedFormatException :" << e.what() << std::endl;
- throw;
- }
-
- const File witness("witness/ttcc");
- LOGUNIT_ASSERT(Compare::compare(FILTERED, witness));
- }
-
std::string createMessage(int i, Pool & pool)
{
std::string msg("Message ");
diff --git a/src/test/cpp/net/telnetappendertestcase.cpp b/src/test/cpp/net/telnetappendertestcase.cpp
index 6fc406d..7ba022e 100644
--- a/src/test/cpp/net/telnetappendertestcase.cpp
+++ b/src/test/cpp/net/telnetappendertestcase.cpp
@@ -16,7 +16,7 @@
*/
#include <log4cxx/net/telnetappender.h>
-#include <log4cxx/ttcclayout.h>
+#include <log4cxx/patternlayout.h>
#include "../appenderskeletontestcase.h"
#include <apr_thread_proc.h>
#include <apr_time.h>
@@ -45,6 +45,11 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
enum { TEST_PORT = 1723 };
+ static LayoutPtr createLayout(){
+ PatternLayoutPtr pl = std::make_shared<PatternLayout>();
+ pl->setConversionPattern( "%r [%t] %-5p - %m%n" );
+ }
+
public:
AppenderSkeleton* createAppenderSkeleton() const
@@ -55,7 +60,7 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
void testActivateClose()
{
TelnetAppenderPtr appender(new TelnetAppender());
- appender->setLayout(LayoutPtr(new TTCCLayout()));
+ appender->setLayout(createLayout());
appender->setPort(TEST_PORT);
Pool p;
appender->activateOptions(p);
@@ -65,7 +70,7 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
void testActivateSleepClose()
{
TelnetAppenderPtr appender(new TelnetAppender());
- appender->setLayout(LayoutPtr(new TTCCLayout()));
+ appender->setLayout(createLayout());
appender->setPort(TEST_PORT);
Pool p;
appender->activateOptions(p);
@@ -76,7 +81,7 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
void testActivateWriteClose()
{
TelnetAppenderPtr appender(new TelnetAppender());
- appender->setLayout(LayoutPtr(new TTCCLayout()));
+ appender->setLayout(createLayout());
appender->setPort(TEST_PORT);
Pool p;
appender->activateOptions(p);
diff --git a/src/test/resources/witness/ttcc b/src/test/resources/witness/ttcc
deleted file mode 100644
index 459718b..0000000
--- a/src/test/resources/witness/ttcc
+++ /dev/null
@@ -1,25 +0,0 @@
- [main] FATAL ERR - Message 0
- [main] ERROR ERR - Message 1
- [main] FATAL INF - Message 2
- [main] ERROR INF - Message 3
- [main] WARN INF - Message 4
- [main] INFO INF - Message 5
- [main] FATAL INF.UNDEF - Message 6
- [main] ERROR INF.UNDEF - Message 7
- [main] WARN INF.UNDEF - Message 8
- [main] INFO INF.UNDEF - Message 9
- [main] FATAL INF.ERR - Message 10
- [main] ERROR INF.ERR - Message 11
- [main] FATAL INF.ERR.UNDEF - Message 12
- [main] ERROR INF.ERR.UNDEF - Message 13
- [main] FATAL DEB - Message 14
- [main] ERROR DEB - Message 15
- [main] WARN DEB - Message 16
- [main] INFO DEB - Message 17
- [main] DEBUG DEB - Message 18
- [main] FATAL UNDEF - Message 19
- [main] ERROR UNDEF - Message 20
- [main] WARN UNDEF - Message 21
- [main] INFO UNDEF - Message 22
- [main] DEBUG UNDEF - Message 23
- [main] INFO INF - Messages should bear numbers 0 through 23.