-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log4cxx: Add version 1.2.0 and replace duplicate version 0.12.0 with version 0.13.0 #16679
Changes from all commits
0db1dd9
2a111d2
b362f67
129895b
738e344
9179b5a
51833ee
e9b5593
b9006b6
7a00cd2
a668703
b2bcf3b
15fbe7f
f229464
f0cfc65
1674f2b
17ea685
85d3e1b
c7ce0a0
c24fbea
192cd0c
da60789
d1ddd7f
9df00e1
8aa1f87
bdbe030
7862dcf
3f8ecec
6fce6e4
4ef6593
c358758
316d836
a97f3bf
a0fbf3d
b5ae993
2d911a1
6e4b536
5ec9817
18fec2b
d898174
9f1e931
229708c
b3f8333
6474728
f5a3b89
e4ecb19
f4c3989
560d167
9297e1c
c749709
754b204
2e73168
57a03e7
682d7eb
9169ec1
33a568a
e62ae41
2c91c77
ec06aab
56ae2d4
9a239a9
9aca6d6
2e75dc1
55f930d
fa40cde
5e9fbc3
98fd698
ea3ef39
029a4af
5c7bc89
0c9da72
a60be82
da9f044
5d322a2
6907079
5fff340
e2c9ebf
42c2980
91a5496
1430ebb
34add1e
ea0de63
8f89000
ed50008
42b3830
541328d
8ef66f3
3d496f1
8373069
3216869
8c77b88
edc9779
d5e4811
d305e29
4b9358b
53330c3
df33a6c
c54ac7e
50e594d
3c9ce67
7002247
e20f6ea
30eb110
2c495c3
31ff81c
495757c
bd16e1b
1dc374a
04fb6ee
6b7ce67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,46 @@ | ||
sources: | ||
"1.2.0": | ||
url: "https://archive.apache.org/dist/logging/log4cxx/1.2.0/apache-log4cxx-1.2.0.tar.gz" | ||
sha256: "09f4748aa5675ef5c0770bedbf5e00488668933c5a935a43ac5b85be2436c48a" | ||
"1.1.0": | ||
url: "https://archive.apache.org/dist/logging/log4cxx/1.1.0/apache-log4cxx-1.1.0.tar.gz" | ||
sha256: "1fc7d82697534184bc0f757348d969d24852b948f63d6b17283fd1ee29c2c28a" | ||
"0.13.0": | ||
url: "https://archive.apache.org/dist/logging/log4cxx/0.13.0/apache-log4cxx-0.13.0.tar.gz" | ||
sha256: "4e5be64b6b1e6de8525f8b87635270b81f772a98902d20d7ac646fdf1ac08284" | ||
"0.12.1": | ||
url: "https://archive.apache.org/dist/logging/log4cxx/0.12.1/apache-log4cxx-0.12.1.tar.gz" | ||
sha256: "7bea5cb477f0e31c838f0e1f4f498cc3b30c2eae74703ddda923e7e8c2268d22" | ||
"0.12.0": | ||
url: "https://archive.apache.org/dist/logging/log4cxx/0.12.0/apache-log4cxx-0.12.0.tar.gz" | ||
sha256: "bd5b5009ca914c8fa7944b92ea6b4ca6fb7d146f65d526f21bf8b3c6a0520e44" | ||
patches: | ||
"1.2.0": | ||
- patch_file: "patches/1.2.0-0001-find-apr.patch" | ||
patch_description: "use cci's package name" | ||
patch_type: "conan" | ||
"1.1.0": | ||
- patch_file: "patches/1.1.0-0001-find-apr.patch" | ||
patch_description: "use cci's package name" | ||
patch_type: "conan" | ||
"0.12.1": | ||
- patch_file: "patches/0.12.0-0001-find-apr.patch" | ||
patch_description: "use cci's package name" | ||
"0.13.0": | ||
- patch_file: "patches/0.13.0-0001-find-apr.patch" | ||
patch_type: "conan" | ||
"0.12.0": | ||
- patch_file: "patches/0.12.0-0001-find-apr.patch" | ||
patch_description: "Use conan generated apr, apr-util target names" | ||
- patch_file: "patches/0.13.0-0001-logchar-type.patch" | ||
patch_type: "bugfix" | ||
patch_description: "Prevent compilation errors when with_wchar_t=False" | ||
patch_source: "https://github.com/apache/logging-log4cxx/commit/5109466a844d1e5fb8b455a23077765a30325a24" | ||
- patch_file: "patches/0.13.0-0001-visual-studio-15.patch" | ||
patch_type: "bugfix" | ||
patch_description: "Prevent Visual Studio 2017 compilation error" | ||
patch_source: "https://github.com/apache/logging-log4cxx/commit/f59bf53f831b8b68ef3a2f3a6705ae626090758e" | ||
- patch_file: "patches/0.13.0-0001-fix-static-library-compilation.patch" | ||
patch_type: "bugfix" | ||
patch_description: "Prevent compilation error when shared=False" | ||
patch_source: "https://github.com/apache/logging-log4cxx/commit/09b5b723a1a210c28bf8b05b0676bb2b104359ba" | ||
"0.12.1": | ||
- patch_file: "patches/0.12.1-0001-find-apr.patch" | ||
patch_description: "use cci's package name" | ||
patch_type: "conan" | ||
- patch_file: "patches/0.12.1-0001-logchar-type.patch" | ||
patch_type: "bugfix" | ||
patch_description: "Prevent compilation errors when with_wchar_t=False" | ||
patch_source: "https://github.com/apache/logging-log4cxx/commit/5109466a844d1e5fb8b455a23077765a30325a24" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,15 +24,44 @@ class Log4cxxConan(ConanFile): | |
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"char_type": ["utf-8", "wchar_t", "unichar"], | ||
"char_encoding": ["utf-8", "locale"], | ||
"with_networking": [True, False], | ||
"with_wchar_t": [True, False], | ||
"with_fmt_layout": [True, False], | ||
"with_odbc_appender": [True, False], | ||
"with_multiprocess_rolling_file_appender": [True, False], | ||
"with_smtp_appender": [True, False], | ||
"with_qt": [True, False], | ||
} | ||
options_description = { | ||
"char_type": "The log4cxx internal character type (selects the std::basic_string template parameter used by log4cxx::LogString)", | ||
"char_encoding": "The external character set used when writing to files", | ||
"with_networking": "Include appenders that use network i/o", | ||
"with_wchar_t": "Include wchar_t API methods in class interfaces", | ||
"with_fmt_layout": "Include the log4cxx::FMTLayout class that uses libfmt to layout messages", | ||
"with_odbc_appender": "Include the log4cxx::ODBCAppender that sends log events to a database", | ||
"with_multiprocess_rolling_file_appender": "Include the appender that allows multiple applications to log to the same file", | ||
"with_smtp_appender": "Include the appender that sends an e-mail when a specific logging event occurs", | ||
"with_qt": "Allow QString values in the LOG4CXX_WARN, LOG4CXX_INFO, LOG4CXX_DEBUG etc. macros", | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"char_type": "utf-8", | ||
"char_encoding": "utf-8", | ||
"with_networking": True, | ||
"with_wchar_t": False, | ||
"with_fmt_layout": False, | ||
"with_odbc_appender": False, | ||
"with_multiprocess_rolling_file_appender": False, | ||
"with_smtp_appender": False, | ||
"with_qt": False, | ||
} | ||
swebb2066 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@property | ||
def _min_cppstd(self): | ||
return 17 | ||
return 11 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
|
@@ -49,7 +78,14 @@ def export_sources(self): | |
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
self.options.rm_safe("fPIC") | ||
self.options.rm_safe("with_smtp_appender") # *nix only | ||
elif Version(self.version) <= "1.0.0": # SMTP appender is broken in version 0.12 through 1.0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any references for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @swebb2066 could you please clarify it? Which error did you have, is there an Github issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to have a reference for this, but it only affects outdated versions and it's a new option, so I'm fine with it as is. |
||
self.options.rm_safe("with_smtp_appender") | ||
if Version(self.version) < "1.0.0": | ||
self.options.rm_safe("with_multiprocess_rolling_file_appender") | ||
self.options.rm_safe("with_networking") | ||
self.options.rm_safe("with_fmt_layout") | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
|
@@ -61,33 +97,55 @@ def layout(self): | |
def requirements(self): | ||
self.requires("apr/1.7.4") | ||
self.requires("apr-util/1.6.1") | ||
self.requires("expat/2.5.0") | ||
if self.settings.os != "Windows": | ||
if self.options.get_safe("with_odbc_appender") and self.settings.os != "Windows": | ||
self.requires("odbc/2.3.11") | ||
if self.options.get_safe("with_smtp_appender"): | ||
self.requires("libesmtp/1.1.0") | ||
if self.options.get_safe("with_fmt_layout"): | ||
self.requires("fmt/10.2.1") | ||
if self.options.get_safe("with_qt"): | ||
self.requires("qt/5.15.12") | ||
|
||
def validate(self): | ||
# TODO: if compiler doesn't support C++17, boost can be used instead | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, self._min_cppstd) | ||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) | ||
if minimum_version and Version(self.settings.compiler.version) < minimum_version: | ||
raise ConanInvalidConfiguration(f"{self.ref} requires a compiler that supports at least C++{self._min_cppstd}") | ||
if Version(self.version) < "1.0.0" or self.options.get_safe("with_multiprocess_rolling_file_appender"): | ||
# TODO: if compiler doesn't support C++17, boost can be used instead | ||
if Version(self.version) < "1.0.0": | ||
self.output.info(f"Version {self.version} requires C++17. log4cxx version 1.x does not.") | ||
else: | ||
self.output.info("multiprocess rolling file appender requires C++17.") | ||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) | ||
compiler_version = Version(self.settings.compiler.version) | ||
if compiler_version < minimum_version: | ||
raise ConanInvalidConfiguration(f"{self.settings.compiler} {compiler_version} does not support C++17: {minimum_version} required.") | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, "17") | ||
|
||
def _patch_sources(self): | ||
apply_conandata_patches(self) | ||
|
||
def build_requirements(self): | ||
if self.settings.os != "Windows": | ||
if not self.conf.get("tools.gnu:pkg_config", check_type=str): | ||
self.tool_requires("pkgconf/2.0.3") | ||
|
||
def source(self): | ||
# OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: | ||
# 'src\\test\\resources\\output\\xyz\\:' | ||
pattern = "*[!:]" | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True, pattern=pattern) | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.cache_variables["BUILD_TESTING"] = False | ||
tc.cache_variables["LOG4CXX_INSTALL_PDB"] = False | ||
tc.variables["BUILD_TESTING"] = False | ||
tc.variables["LOG4CXX_INSTALL_PDB"] = False | ||
if Version(self.version) >= "1.0.0": | ||
tc.variables["LOG4CXX_NETWORKING_SUPPORT"] = self.options.with_networking | ||
tc.variables["LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER"] = self.options.with_multiprocess_rolling_file_appender | ||
tc.variables["ENABLE_FMT_LAYOUT"] = self.options.with_fmt_layout | ||
if Version(self.version) > "1.0.0" and self.settings.os != "Windows": | ||
tc.variables["LOG4CXX_ENABLE_ESMTP"] = self.options.with_smtp_appender | ||
tc.variables["LOG4CXX_ENABLE_ODBC"] = self.options.with_odbc_appender | ||
tc.variables["LOG4CXX_CHAR"] = self.options.char_type | ||
tc.variables["LOG4CXX_CHARSET"] = self.options.char_encoding | ||
tc.variables["LOG4CXX_WCHAR_T"] = self.options.with_wchar_t | ||
tc.variables["LOG4CXX_QT_SUPPORT"] = self.options.with_qt | ||
tc.generate() | ||
tc = CMakeDeps(self) | ||
tc.generate() | ||
|
@@ -141,3 +199,4 @@ def package_info(self): | |
# TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed | ||
swebb2066 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] | ||
self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- a/src/main/include/CMakeLists.txt | ||
+++ b/src/main/include/CMakeLists.txt | ||
@@ -22,9 +22,18 @@ endif() | ||
|
||
if(${LOG4CXX_CHAR} STREQUAL "unichar") | ||
set(LOGCHAR_IS_UNICHAR 1) | ||
+ set(LOGCHAR_IS_WCHAR 0) | ||
+ set(LOGCHAR_IS_UTF8 0) | ||
elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t") | ||
set(LOGCHAR_IS_WCHAR 1) | ||
+ set(LOGCHAR_IS_UNICHAR 0) | ||
+ set(LOGCHAR_IS_UTF8 0) | ||
+elseif(${LOG4CXX_CHAR} STREQUAL "utf-8") | ||
+ set(LOGCHAR_IS_UNICHAR 0) | ||
+ set(LOGCHAR_IS_WCHAR 0) | ||
+ set(LOGCHAR_IS_UTF8 1) | ||
endif() | ||
+ | ||
option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON) | ||
option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF) | ||
set(INIT_IOS_BASE 0) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -41,10 +41,12 @@ if(NOT BUILD_SHARED_LIBS) | ||
endif() | ||
|
||
# Find Apache Runtime | ||
-find_package(APR REQUIRED) | ||
+find_package(apr REQUIRED) | ||
+set(APR_LIBRARIES apr::apr) | ||
|
||
# Find Apache Runtime Utilities | ||
-find_package(APR-Util REQUIRED) | ||
+find_package(apr-util REQUIRED) | ||
+set(APR_UTIL_LIBRARIES apr-util::apr-util) | ||
|
||
find_package( Threads REQUIRED ) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- a/src/main/cpp/threadutility.cpp | ||
+++ b/src/main/cpp/threadutility.cpp | ||
@@ -16,6 +16,9 @@ | ||
*/ | ||
|
||
#include "log4cxx/helpers/threadutility.h" | ||
+#if !defined(LOG4CXX) | ||
+ #define LOG4CXX 1 | ||
+#endif | ||
#include "log4cxx/private/log4cxx_private.h" | ||
#include "log4cxx/helpers/loglog.h" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp | ||
index c14c12fd..057ecd86 100644 | ||
--- a/src/main/cpp/threadutility.cpp | ||
+++ b/src/main/cpp/threadutility.cpp | ||
@@ -113,11 +113,13 @@ void ThreadUtility::threadStartedNameThread(LogString threadName, | ||
std::thread::id /*threadId*/, | ||
std::thread::native_handle_type nativeHandle){ | ||
#if LOG4CXX_HAS_PTHREAD_SETNAME | ||
- if( pthread_setname_np( static_cast<pthread_t>( nativeHandle ), threadName.c_str() ) < 0 ){ | ||
- LOGLOG_ERROR( LOG4CXX_STR("unable to set thread name") ); | ||
+ LOG4CXX_ENCODE_CHAR(sthreadName, threadName); | ||
+ if (pthread_setname_np(static_cast<pthread_t>(nativeHandle), sthreadName.c_str()) < 0) { | ||
+ LOGLOG_ERROR(LOG4CXX_STR("unable to set thread name")); | ||
} | ||
#elif LOG4CXX_HAS_SETTHREADDESCRIPTION | ||
- HRESULT hr = SetThreadDescription(static_cast<HANDLE>(nativeHandle), threadName.c_str()); | ||
+ LOG4CXX_ENCODE_WCHAR(wthreadName, threadName); | ||
+ HRESULT hr = SetThreadDescription(static_cast<HANDLE>(nativeHandle), wthreadName.c_str()); | ||
if(FAILED(hr)){ | ||
LOGLOG_ERROR( LOG4CXX_STR("unable to set thread name") ); | ||
} | ||
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt | ||
index e31443fb..32122e41 100644 | ||
--- a/src/main/include/CMakeLists.txt | ||
+++ b/src/main/include/CMakeLists.txt | ||
@@ -39,9 +39,18 @@ endif() | ||
|
||
if(${LOG4CXX_CHAR} STREQUAL "unichar") | ||
set(LOGCHAR_IS_UNICHAR 1) | ||
+ set(LOGCHAR_IS_WCHAR 0) | ||
+ set(LOGCHAR_IS_UTF8 0) | ||
elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t") | ||
set(LOGCHAR_IS_WCHAR 1) | ||
+ set(LOGCHAR_IS_UNICHAR 0) | ||
+ set(LOGCHAR_IS_UTF8 0) | ||
+elseif(${LOG4CXX_CHAR} STREQUAL "utf-8") | ||
+ set(LOGCHAR_IS_UNICHAR 0) | ||
+ set(LOGCHAR_IS_WCHAR 0) | ||
+ set(LOGCHAR_IS_UTF8 1) | ||
endif() | ||
+ | ||
option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON) | ||
option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF) | ||
set(INIT_IOS_BASE 0) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp | ||
index b57ab66..ef48704 100644 | ||
--- a/src/main/cpp/threadutility.cpp | ||
+++ b/src/main/cpp/threadutility.cpp | ||
@@ -27,7 +27,11 @@ | ||
#include <processthreadsapi.h> | ||
#endif | ||
|
||
-using log4cxx::helpers::ThreadUtility; | ||
+namespace log4cxx | ||
+{ | ||
+namespace helpers | ||
+{ | ||
+ | ||
|
||
struct ThreadUtility::priv_data{ | ||
priv_data(){ | ||
@@ -36,9 +40,9 @@ struct ThreadUtility::priv_data{ | ||
start_post = nullptr; | ||
} | ||
|
||
- log4cxx::helpers::ThreadStartPre start_pre; | ||
- log4cxx::helpers::ThreadStarted started; | ||
- log4cxx::helpers::ThreadStartPost start_post; | ||
+ ThreadStartPre start_pre; | ||
+ ThreadStarted started; | ||
+ ThreadStartPost start_post; | ||
}; | ||
|
||
#if LOG4CXX_HAS_PTHREAD_SIGMASK | ||
@@ -138,14 +142,18 @@ void ThreadUtility::postThreadUnblockSignals(){ | ||
} | ||
|
||
|
||
-log4cxx::helpers::ThreadStartPre ThreadUtility::preStartFunction(){ | ||
+ThreadStartPre ThreadUtility::preStartFunction(){ | ||
return m_priv->start_pre; | ||
} | ||
|
||
-log4cxx::helpers::ThreadStarted ThreadUtility::threadStartedFunction(){ | ||
+ThreadStarted ThreadUtility::threadStartedFunction(){ | ||
return m_priv->started; | ||
} | ||
|
||
-log4cxx::helpers::ThreadStartPost ThreadUtility::postStartFunction(){ | ||
+ThreadStartPost ThreadUtility::postStartFunction(){ | ||
return m_priv->start_post; | ||
} | ||
+ | ||
+} //namespace helpers | ||
+} //namespace log4cxx | ||
+ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 61c0479..6ac3e77 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -51,16 +51,18 @@ endif() | ||
|
||
# Find Apache Runtime | ||
option(APR_STATIC "Link to the APR static library" OFF) | ||
-find_package(APR REQUIRED) | ||
+find_package(apr REQUIRED) | ||
+set(APR_LIBRARIES apr::apr) | ||
|
||
# Find Apache Runtime Utilities | ||
option(APU_STATIC "Link to the APR-Util static library" OFF) | ||
-find_package(APR-Util REQUIRED) | ||
+find_package(apr-util REQUIRED) | ||
+set(APR_UTIL_LIBRARIES apr-util::apr-util) | ||
|
||
find_package( Threads REQUIRED ) | ||
|
||
# Find expat for XML parsing | ||
-find_package(EXPAT REQUIRED) | ||
+find_package(EXPAT REQUIRED MODULE) | ||
if(TARGET EXPAT::EXPAT) | ||
set(EXPAT_LIBRARIES EXPAT::EXPAT) | ||
elseif(TARGET expat::expat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need the version 0.13.0? I would suggest only adding 1.1.0, then if someone open an issue requesting, add it. Add new versions not only cost CI resources, but also may need people that are using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up!