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 b939921e Support for \{fmt} version 11 and 12 (#706)
b939921e is described below
commit b939921e634f8507c1534103f476ad5749d5f7b8
Author: Stephen Webb <[email protected]>
AuthorDate: Fri Jun 5 10:43:18 2026 +1000
Support for \{fmt} version 11 and 12 (#706)
* Retain ABI compatibility with 1.6.1
---
.github/workflows/log4cxx-windows.yml | 11 +++++----
src/main/cpp/asyncbuffer.cpp | 32 ++++++++++++++++++--------
src/main/include/log4cxx/helpers/asyncbuffer.h | 14 +++++++++--
src/site/markdown/change-report-gh.md | 3 +++
4 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/.github/workflows/log4cxx-windows.yml
b/.github/workflows/log4cxx-windows.yml
index cc7e2a14..b144dcc2 100644
--- a/.github/workflows/log4cxx-windows.yml
+++ b/.github/workflows/log4cxx-windows.yml
@@ -23,20 +23,21 @@ jobs:
strategy:
fail-fast: false
matrix:
- name: [windows-2022, windows-2025, windows-2025-qt]
+ name: [windows-2022, windows-2025-fmt, windows-2025-qt]
include:
- name: windows-2022
os: windows-2022
qt: OFF
next_abi: OFF
- - name: windows-2025
+ - name: windows-2025-fmt
os: windows-2025
qt: OFF
next_abi: ON
+ vcpkg_options: fmt
- name: windows-2025-qt
os: windows-2025
qt: ON
- qt_component: qtbase
+ vcpkg_options: qtbase
next_abi: OFF
steps:
@@ -58,7 +59,7 @@ jobs:
with:
repository: microsoft/vcpkg
path: vcpkg
- ref: 2025.07.25
+ ref: 2026.05.25
- name: 'Configure Dependencies'
if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true'
@@ -67,7 +68,7 @@ jobs:
run: |
cd vcpkg
./bootstrap-vcpkg.bat
- ./vcpkg install apr apr-util fmt ${{ matrix.qt_component }}
--triplet=x64-windows
+ ./vcpkg install apr apr-util ${{ matrix.vcpkg_options }}
--triplet=x64-windows
- name: 'Install zip'
id: install-zip
diff --git a/src/main/cpp/asyncbuffer.cpp b/src/main/cpp/asyncbuffer.cpp
index 39cb4fb5..56c6d425 100644
--- a/src/main/cpp/asyncbuffer.cpp
+++ b/src/main/cpp/asyncbuffer.cpp
@@ -44,8 +44,8 @@ struct AsyncBuffer::Private
StringViewType fmt_string;
FmtArgStore fmt_args;
- Private(StringViewType&& format_string, FmtArgStore&& args)
- : fmt_string{ std::move(format_string) }
+ Private(const StringViewType& format_string, FmtArgStore&& args)
+ : fmt_string{ format_string }
, fmt_args{ std::move(args) }
{}
@@ -53,8 +53,8 @@ struct AsyncBuffer::Private
WideStringViewType fmt_wstring;
WideFmtArgStore fmt_wargs;
- Private(WideStringViewType&& format_string, WideFmtArgStore&& args)
- : fmt_wstring{ std::move(format_string) }
+ Private(const WideStringViewType& format_string, WideFmtArgStore&& args)
+ : fmt_wstring{ format_string }
, fmt_wargs{ std::move(args) }
{}
#endif // LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
@@ -63,31 +63,43 @@ struct AsyncBuffer::Private
};
#if LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
-void AsyncBuffer::initializeForFmt(StringViewType&& format_string,
FmtArgStore&& args)
+void AsyncBuffer::initializeForFmt(const StringViewType& format_string,
FmtArgStore&& args)
{
if (!m_priv)
- m_priv = std::make_unique<Private>(std::move(format_string),
std::move(args));
+ m_priv = std::make_unique<Private>(format_string,
std::move(args));
else
{
- m_priv->fmt_string = std::move(format_string);
+ m_priv->fmt_string = format_string;
m_priv->fmt_args = std::move(args);
}
}
#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
-void AsyncBuffer::initializeForFmt(WideStringViewType&& format_string,
WideFmtArgStore&& args)
+void AsyncBuffer::initializeForFmt(const WideStringViewType& format_string,
WideFmtArgStore&& args)
{
if (!m_priv)
- m_priv = std::make_unique<Private>(std::move(format_string),
std::move(args));
+ m_priv = std::make_unique<Private>(format_string,
std::move(args));
else
{
- m_priv->fmt_wstring = std::move(format_string);
+ m_priv->fmt_wstring = format_string;
m_priv->fmt_wargs = std::move(args);
}
}
#endif // LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
#endif // LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
+#if LOG4CXX_ABI_VERSION <= 15
+#if LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
+void AsyncBuffer::initializeForFmt(StringViewType&& format_string,
FmtArgStore&& args)
+{ initializeForFmt(format_string, std::move(args)); }
+
+#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
+void AsyncBuffer::initializeForFmt(WideStringViewType&& format_string,
WideFmtArgStore&& args)
+{ initializeForFmt(format_string, std::move(args)); }
+#endif // LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
+#endif // LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
+#endif // LOG4CXX_ABI_VERSION <= 15
+
/** An empty buffer.
*/
AsyncBuffer::AsyncBuffer()
diff --git a/src/main/include/log4cxx/helpers/asyncbuffer.h
b/src/main/include/log4cxx/helpers/asyncbuffer.h
index 5639f906..023a3df5 100644
--- a/src/main/include/log4cxx/helpers/asyncbuffer.h
+++ b/src/main/include/log4cxx/helpers/asyncbuffer.h
@@ -204,7 +204,7 @@ public: // Modifiers
{
auto store = FmtArgStore();
( store.push_back(std::forward<Args>(args)), ...);
- initializeForFmt(std::move(fmt_str), std::move(store));
+ initializeForFmt(fmt_str, std::move(store));
}
#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
@@ -215,7 +215,7 @@ public: // Modifiers
{
auto store = WideFmtArgStore();
( store.push_back(std::forward<Args>(args)), ...);
- initializeForFmt(std::move(fmt_str), std::move(store));
+ initializeForFmt(fmt_str, std::move(store));
}
#endif // LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
#endif // LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
@@ -250,6 +250,15 @@ private:
void append(MessageBufferAppender&& f);
#endif // !LOG4CXX_CONCEPTS
+#if LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
+ void initializeForFmt(const StringViewType& format_string,
FmtArgStore&& args);
+
+#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
+ void initializeForFmt(const WideStringViewType& format_string,
WideFmtArgStore&& args);
+#endif // LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
+#endif // LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
+
+#if LOG4CXX_ABI_VERSION <= 15
#if LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
void initializeForFmt(StringViewType&& format_string, FmtArgStore&&
args);
@@ -257,6 +266,7 @@ private:
void initializeForFmt(WideStringViewType&& format_string,
WideFmtArgStore&& args);
#endif // LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR
#endif // LOG4CXX_ASYNC_BUFFER_SUPPORTS_FMT
+#endif // LOG4CXX_ABI_VERSION <= 15
};
} // namespace helpers
diff --git a/src/site/markdown/change-report-gh.md
b/src/site/markdown/change-report-gh.md
index 5fc8ec25..892d98fb 100644
--- a/src/site/markdown/change-report-gh.md
+++ b/src/site/markdown/change-report-gh.md
@@ -93,6 +93,9 @@ The following issues have been addressed:
* RollingFileAppender could name the rolled file ".1"
\[[#697](https://github.com/apache/logging-log4cxx/issues/697)\]
+* {fmt} library version 11 and 12 incompatibility
+ \[[#700](https://github.com/apache/logging-log4cxx/issues/700)\]
+
## Release 1.7.0 - 2026-04-04 {#rel_1_7_0}
Release 1.7.0 includes the following new features: