This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new d52c0d5d Restore console output compactness (#683)
d52c0d5d is described below
commit d52c0d5d0324264828e922196d771e5b4a0dd866
Author: Stephen Webb <[email protected]>
AuthorDate: Thu May 21 12:10:05 2026 +1000
Restore console output compactness (#683)
---
src/main/cpp/consolewriter.cpp | 1 -
src/test/cpp/helpers/consolewritertestcase.cpp | 10 +++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/main/cpp/consolewriter.cpp b/src/main/cpp/consolewriter.cpp
index 52118d90..0acfdae9 100644
--- a/src/main/cpp/consolewriter.cpp
+++ b/src/main/cpp/consolewriter.cpp
@@ -53,6 +53,5 @@ size_t helpers::writeToConsole(const LogString& str, FILE
*file)
// as the message may contain embedded null bytes, which would cause the
// message to be prematurely truncated.
//
- msg.append("\n");
return fwrite(msg.data(), 1, msg.size(), file);
}
diff --git a/src/test/cpp/helpers/consolewritertestcase.cpp
b/src/test/cpp/helpers/consolewritertestcase.cpp
index e44e23ff..bb366998 100644
--- a/src/test/cpp/helpers/consolewritertestcase.cpp
+++ b/src/test/cpp/helpers/consolewritertestcase.cpp
@@ -46,15 +46,13 @@ public:
std::string path = tmpdir;
path += "/log4cxx.test.log";
- remove(path.c_str());
-
- std::string message{"Hello\0World!", 12};
+ std::string message{"Hello\0World!\n", 13};
{
FILE *fp = fopen(path.c_str(), "wb");
LOG4CXX_DECODE_CHAR(lsMessage, message);
size_t written = helpers::writeToConsole(lsMessage, fp);
- LOGUNIT_ASSERT_EQUAL(message.size() + 1, written);
+ LOGUNIT_ASSERT_EQUAL(message.size(), written);
fclose(fp);
}
@@ -68,7 +66,9 @@ public:
fclose(fp);
}
- LOGUNIT_ASSERT_EQUAL(content, message + "\n");
+ remove(path.c_str());
+
+ LOGUNIT_ASSERT(content == message);
}
};