GithubHelp home page GithubHelp logo

apache / logging-log4cxx Goto Github PK

View Code? Open in Web Editor NEW
257.0 23.0 120.0 13.13 MB

Apache Log4cxx is a C++ port of Apache Log4j

Home Page: http://logging.apache.org/log4cxx

License: Apache License 2.0

C++ 94.03% C 0.57% XSLT 0.11% CSS 0.02% Roff 1.44% CMake 3.67% HTML 0.15%
logging apache cpp

logging-log4cxx's Introduction

logging-log4cxx's People

Contributors

ams-tschoening avatar arahaan avatar azbarcea avatar baldapps avatar bblough avatar bieriol avatar coldtobi avatar craterone avatar derdakon avatar ffontaine avatar grobmeier avatar hex052 avatar hustterry avatar jmdavison46 avatar jstsddg avatar kschoelhorn avatar landwehrj avatar nturner avatar petitlapin avatar pm-cfs avatar pseiderer avatar rm5248 avatar rprevot avatar ryanshin0112 avatar sebbasf avatar stephen-webb avatar swebb2066 avatar vopl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logging-log4cxx's Issues

FMT macros fail to build with no arguments

I've come back to some code that I'm pretty sure worked before:

LOG4CXX_INFO_FMT(logger, "hello");

However, GCC 12.2 and clang 14 both fail to compile this code. I'm fairly certain it compiled properly with GCC 10.2.

The problem is that in our macros we use __VA_ARGS__ which because there are no arguments seems to cause an error in these compilers. The workaround for now is to simply use LOG4CXX_INFO instead of the _FMT series of macros or to simply add an (unused) argument, but this seems a little silly.

It seems that with C++20, we could do __VA_OPT__(,) __VA_ARGS__. Ideally we should be able to support versions before C++20 in a portable way.

Some more info:
https://stackoverflow.com/questions/5891221/variadic-macros-with-zero-arguments
https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html

Incorrect destructor handling in FileWatchdog causes crashes

If you change the log file before the application terminates, it may crash due to pure virtual call.

It happens because the FileWatchdog destructor works incorrectly, or rather its main function, which works in a separate thread, reacts to a stop from the destructor. When the class signals it to stop from its destructor, the destructor of the derived class has already finished its work and reset the vtable. The worker thread itself, even when receiving FileWatchdog::is_interrupted, tries to call FileWatchdog::checkAndConfigure, from within which a purely virtual function is called.

Use Logging Services common pages

I have revamped the Download, Support, and Security pages of Logging Services (LS) such that they now cover all LS projects. In the Log4j website, I have wired all associated links to there and I have replaced all overlapping content to point to there. Would you consider implementing the following changes for the left menu of the Log4cxx website?

  1. Replace "Community" and all sublinks/pages under it with a "Support" link pointing to the LS Support page
  2. Point "Get > Download" to the LS Download page
  3. Add a "Security" link pointing to the LS Security page

LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC

I originally found this issue when compiling log4cxx 1.0.0 as a DLL in the MSYS2 environment on Windows, using GCC 12. It is however a general problem and can be easily reproduced with GCC on Linux, as follows.

Change LOG4CXX_INSTANTIATE_EXPORTED_PTR in src/main/include/log4cxx/log4cxx.h.in to make it identical as for the Win32/DLL case. That is:

Change
#define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T)
to
#define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>

Compiling on Ubuntu 22.04 with GCC 11:

$ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cmake --build cmake_build --target install --config RelWithDebInfo --parallel
Checking configuration
[  0%] Built target configure_log4cxx
Consolidate compiler generated dependencies of target log4cxx
[  2%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/class.cpp.o
[  2%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/defaultconfigurator.cpp.o
[  3%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/domconfigurator.cpp.o
[  4%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/filterbasedtriggeringpolicy.cpp.o
[  5%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/inputstreamreader.cpp.o
[  6%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/optionconverter.cpp.o
[  6%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/properties.cpp.o
[  7%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/propertyconfigurator.cpp.o
[  8%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/propertysetter.cpp.o
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/inputstreamreader.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::InputStream>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/helpers/inputstreamreader.h:32:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   32 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(InputStream);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::CharsetDecoder>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/helpers/inputstreamreader.h:33:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   33 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(CharsetDecoder);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/propertysetter.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:762: src/main/cpp/CMakeFiles/log4cxx.dir/inputstreamreader.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/properties.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::InputStream>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/helpers/inputstreamreader.h:32:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   32 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(InputStream);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::CharsetDecoder>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/helpers/inputstreamreader.h:33:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   33 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(CharsetDecoder);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1392: src/main/cpp/CMakeFiles/log4cxx.dir/properties.cpp.o] Error 1
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/filterbasedtriggeringpolicy.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::spi::Filter>’ in namespace ‘log4cxx::rolling’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h:39:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   39 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::spi::Filter);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:636: src/main/cpp/CMakeFiles/log4cxx.dir/filterbasedtriggeringpolicy.cpp.o] Error 1
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/propertyconfigurator.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/optionconverter.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1448: src/main/cpp/CMakeFiles/log4cxx.dir/propertysetter.cpp.o] Error 1
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/domconfigurator.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/defaultconfigurator.cpp:17:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1280: src/main/cpp/CMakeFiles/log4cxx.dir/optionconverter.cpp.o] Error 1
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::spi::Filter>’ in namespace ‘log4cxx::rolling’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h:39:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   39 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::spi::Filter);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:426: src/main/cpp/CMakeFiles/log4cxx.dir/defaultconfigurator.cpp.o] Error 1
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1420: src/main/cpp/CMakeFiles/log4cxx.dir/propertyconfigurator.cpp.o] Error 1
In file included from src/main/include/log4cxx/logstring.h:22,
                 from src/main/cpp/class.cpp:18:
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::spi::Filter>’ in namespace ‘log4cxx::rolling’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h:39:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   39 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::spi::Filter);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
   94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
      |                                                                                ^~~~~~~~~~~~~
src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
   30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:468: src/main/cpp/CMakeFiles/log4cxx.dir/domconfigurator.cpp.o] Error 1
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:272: src/main/cpp/CMakeFiles/log4cxx.dir/class.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:226: src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Support for filters in PropertyConfigurator

From the docs[https://logging.apache.org/log4cxx/latest_stable/classlog4cxx_1_1PropertyConfigurator.html]:
"
The PropertyConfigurator does not handle the advanced configuration features supported by the DOMConfigurator such as support for Filters, custom ErrorHandlers, nested appenders such as the AsyncAppender, etc.
"
Did anyone added or attempted to add support for filter when using PropertyConfigurator and a properties file such as
...
log4j.appender..filter.=Custom or built in filter
log4j.appender..filter..param1=X
log4j.appender..filter..param2=Y
...

Error building log4cxx with cmake, APR_STATIC and APU_STATIC options

Based on the answer to this issue #362 I have done following steps on both Ubuntu 18.04 and Ubuntu 22.04.

Initial steps

	# mkdir /home/test_build_log4cxx_with_static_apr_libs
	# mkdir /home/test_build_log4cxx_with_static_apr_libs/target

libapr compilation steps

	# cd /home/test_build_log4cxx_with_static_apr_libs
	# mkdir apr
	# cd apr
	# curl -L -O https://archive.apache.org/dist/apr/apr-1.7.4.tar.bz2
	# tar xf apr-1.7.4.tar.bz2
	# cd apr-1.7.4
	# touch libtoolT
	# export CFLAGS=-fPIC
	# ./configure --prefix=/home/test_build_log4cxx_with_static_apr_libs/target
	# make install

libapr-util compilation steps

	# cd /home/test_build_log4cxx_with_static_apr_libs/apr
	# curl -L -O https://archive.apache.org/dist/apr/apr-util-1.6.3.tar.bz2
	# tar xf apr-util-1.6.3.tar.bz2
	# cd apr-util-1.6.3
	# export CFLAGS=-fPIC
	# ./configure --prefix=/home/test_build_log4cxx_with_static_apr_libs/target --with-apr=/home/test_build_log4cxx_with_static_apr_libs/target
	# make install	

log4cxx compilation steps

	# cd /home/test_build_log4cxx_with_static_apr_libs
	# mkdir log4cxx
	# cd log4cxx
	# curl -L -O https://dlcdn.apache.org/logging/log4cxx/1.2.0/apache-log4cxx-1.2.0.tar.gz
	# tar xzvf apache-log4cxx-1.2.0.tar.gz
	# cd apache-log4cxx-1.2.0
	# mkdir build
	# cd build
	# cmake -DAPR_STATIC=yes -DAPU_STATIC=yes -DCMAKE_PREFIX_PATH=/home/test_build_log4cxx_with_static_apr_libs/target/ ..
	# make
	# make install					

I have no problems on Ububntu 22.04, but on Ubuntu 18.04, the make command output ends like this:

[ 54%] Building CXX object src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/autoconfiguretestcase.cpp.o
[ 54%] Linking CXX executable autoconfiguretestcase
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlclose'
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlsym'
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlopen'
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/build.make:100: recipe for target 'src/test/cpp/autoconfiguretestcase' failed
make[2]: *** [src/test/cpp/autoconfiguretestcase] Error 1
CMakeFiles/Makefile2:1419: recipe for target 'src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/all' failed
make[1]: *** [src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2

Error when Cross-compiling Log4CXX library for Linux Arm Cortex A9

I'm trying to cross compile the log4cxx lib for an Linux-Arm-Cortex-A9

  1. I installed a folder from git about Linux-Arm-Cortex-A9 "https://github.com/Christopher83/arm-cortex_a9-linux-gnueabihf-linaro_4.9" and I used it directly without doing a build in my pc because i don't know how .
  2. Downloading and extracting source code of Log4CXX "apache-log4cxx-1.0.0"

Capt

  • I need to compile it, it's very important for me because it's for my final project, otherwise I will change all the code to use Poco instead of log4cxx.
    I used log4cxx for the LOG message in my shared library .

Hexdump logging feature

Since I do a lot of low-level code, it would be very convenient to have a function of some kind that can log data in a hexdump format. That way, I can pass it either a C array or a std::vector in order to dump the data in a readable manner.

Hexdump output for reference:

robert@debian:~/logging-log4cxx$ hd LICENSE 
00000000  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000020  20 20 41 70 61 63 68 65  20 4c 69 63 65 6e 73 65  |  Apache License|
00000030  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000040  20 20 20 20 20 20 20 20  20 20 20 20 56 65 72 73  |            Vers|
00000050  69 6f 6e 20 32 2e 30 2c  20 4a 61 6e 75 61 72 79  |ion 2.0, January|
00000060  20 32 30 30 34 0a 20 20  20 20 20 20 20 20 20 20  | 2004.          |
00000070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 68 74  |              ht|

idea for API:

void logArray(LoggerPtr, LevelPtr, LogString prefix, void* data, size_t data_len)

example output:
com.foo.bar INFO - prefix string:
00000000  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               | 
...

Need a cmake flag to bypass the ODBC appender build

log4cxx/src/main/include/CMakeLists.txt contains a pkg-config check for ODBC, and if it is available, then the ODBC appender will be compiled and log4cxx will depend on the ODBC shared library.

If the log4cxx library is compiled on a system that has libodbc, but then used on a separate system that does not have libodbc, then it will fail to load.

Basically, I'm looking for a flag that can be used to disable the ODBC appender from the cmake command line.

Question: using AsyncAppender

Hello!

So, I'm working on a program that produce about 100K rows of data per minute and approximately each row is about 2K. While using simple and straightforward FileAppender works just fine. I was thinking how could I optimize it more.

Please help me to see if I understand it correctly:
1- Using AsyncAppender would potentially assist me to solve the write-operations blocking issues.
2- It is possible to configure the BufferSize (bounded-buffer) parameter for AsyncAppender in XML DOM. But then I dont know what is default value, or how should I calculate it based on my program context.
3- The FileAppender also exposes BufferedIO and BufferSize. Again, I dont know what is default behavior and If I need to use that or not (the calculation method..)
4- Based on the nature of AsyncAppender class (asynchronous-based operations), there could be a situation that some data get aborted when application exited. If thats correct, Is there anyway that let me enforce the AsyncAppender object to write down remaining data before program exited ?

My last question is not related to Appenders, but I just wanted to know if it is possible to call the DOMConfigurator::configure function multiple times in my program ? I'm asking this, because lets say I'm using logging different logs for different log-levels. So, based on the configured value for <priority> in <category> tags, I would actually let the program to generate the logs I'd expected to see. For now, every time I want to change the log-level I have to restart the program. I was thinking if it applicable to call the function to reload the xml file to change the log-level for example and without requiring program to get restart ?

Thanks.

dailyrollingfileappender.h and rollingfileappender.h files are missing.

Hi Team,
I downloaded latest version of Log4cxx 1.0.0. I created Visual Studio 2022 project file using CMake as shown in attached snapshot. After successful configuration able to generate project file, however dailyrollingfileappender.h and rollingfileappender.h files are missing.
By including these files we have implemented daily file rollover. In new version of Log4cxx these files are not there.

Could you please help on this. If those files are absolute please let me know what are the alternative files.

Log4cxx_After_Generate

CMake build failure with MultiprocessRollingFileAppender

Hi, I am trying to build log4cxx with the MultiprocessRollingFileAppender using CMake with the following command:

cmake -B build -S . -DLOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER=ON -DCMAKE_CXX_STANDARD=17

When I build the project, I get the following error:

/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp: In member function ‘const string log4cxx::rolling::TimeBasedRollingPolicy::createFile(const string&, const string&, log4cxx::helpers::Pool&)’:
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:181:21: error: ‘log4cxx::filesystem’ has not been declared
  181 |         LOG4CXX_NS::filesystem::path path(fileName);
      |                     ^~~~~~~~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:182:35: error: ‘path’ was not declared in this scope
  182 |         std::string newFilename = path.filename().string() + szUid + suffix;
      |                                   ^~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:182:35: note: suggested alternatives:
In file included from /usr/include/c++/11/filesystem:45,
                 from /home/harish/build/original-log4cxx/build/src/main/include/log4cxx/private/boost-std-configuration.h:9,
                 from /home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:31:
/usr/include/c++/11/bits/fs_path.h:248:9: note:   ‘std::filesystem::__cxx11::path’
  248 |   class path
      |         ^~~~
In file included from /home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:31:
/home/harish/build/original-log4cxx/build/src/main/include/log4cxx/private/boost-std-configuration.h:12:35: note:   ‘{anonymous}::filesystem::path’

   12 |     typedef std::filesystem::path path;
      |                                   ^~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:183:21: error: ‘log4cxx::filesystem’ has not been declared
  183 |         LOG4CXX_NS::filesystem::path retval = path.parent_path() / newFilename;
      |                     ^~~~~~~~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:184:16: error: ‘retval’ was not declared in this scope
  184 |         return retval.string();
      |                ^~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1868: src/main/cpp/CMakeFiles/log4cxx.dir/timebasedrollingpolicy.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1366: src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

After scratching my head for a bit, I found the boost-std-configuration.h file inside my cmake build folder:

#ifndef BOOST_STD_CONFIGURATION_H
#define BOOST_STD_CONFIGURATION_H

#define STD_FILESYSTEM_FOUND 1
#define Boost_FILESYSTEM_FOUND 0
#define STD_EXPERIMENTAL_FILESYSTEM_FOUND 1

#if STD_FILESYSTEM_FOUND
#include <filesystem>
namespace  {
namespace filesystem {
    typedef std::filesystem::path path;
}
}
#elif STD_EXPERIMENTAL_FILESYSTEM_FOUND
#include <experimental/filesystem>
namespace  {
namespace filesystem {
    typedef std::experimental::filesystem::path path;
}
}
#elif Boost_FILESYSTEM_FOUND
#include <boost/filesystem.hpp>
namespace  {
namespace filesystem {
    typedef boost::filesystem::path path;
}
}
#endif

#endif /* BOOST_STD_CONFIGURATION_H */

which is generated by this:

configure_file(${LOG4CXX_SOURCE_DIR}/src/cmake/boost-fallback/boost-std-configuration.h.cmake
               ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/boost-std-configuration.h

That value is not set and comes up empty when trying to print with: message (NAMESPACE=${NAMESPACE_ALIAS})
gives the following in the output:NAMESPACE=

The build errors do go away when built with the CMake option -DLOG4CXX_NS="log4cxx"

I'm happy to help with any further investigations.

Built latest log4cxx with gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Thanks

Error building log4cxx with cmake and APR_STATIC option

Steps to reproduce:

# curl -L -O https://dlcdn.apache.org/logging/log4cxx/1.2.0/apache-log4cxx-1.2.0.tar.gz
# tar xzvf apache-log4cxx-1.2.0.tar.gz				
# apt-get install build-essential libapr1-dev libaprutil1-dev gzip zip
# cd apache-log4cxx-1.2.0
# mkdir build
# cd build
# cmake -DAPR_STATIC=yes ..
# make VERBOSE=1

cmake output:
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found APR: /usr/lib/x86_64-linux-gnu/libapr-1.a
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'apr-util-1'
-- Found apr-util-1, version 1.6.1
-- Found APR-Util: /usr/lib/x86_64-linux-gnu/libaprutil-1.so;/usr/lib/x86_64-linux-gnu/libldap.so;/usr/lib/x86_64-linux-gnu/liblber.so
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.4.7")
-- Looking for C++ include locale
-- Looking for C++ include locale - found
-- Looking for mbsrtowcs
-- Looking for mbsrtowcs - found
-- Looking for wcstombs
-- Looking for wcstombs - found
-- Looking for fwide
-- Looking for fwide - found
-- Looking for syslog
-- Looking for syslog - found
-- Looking for pthread_sigmask
-- Looking for pthread_sigmask - found
-- Looking for pthread_self
-- Looking for pthread_self - found
-- log4cxx configuration summary:

-- C++ compiler .................... : /usr/bin/c++
-- C++ features requested: ......... : 20
-- Build shared library ............ : ON
-- Build tests ..................... : ON
-- Build examples................... : ON
-- Build site ...................... : OFF
-- Install prefix .................. : /usr/local
-- log4cxx library name ............ : log4cxx
-- log4cxx namespace ............... : log4cxx
-- log4cxx char API ................ : ON
-- log4cxx wchar API ............... : ON
-- log4cxx unichar API ............. : OFF
-- log4cxx char type ............... : utf-8
-- character encoding .............. : utf-8
-- Networking support .............. : ON
-- DOMConfigurator support ......... : ON
-- Qt support ...................... : OFF
-- C++ version and Boost settings:
-- Prefer boost: ................... : OFF
-- make_unique implementation :..... : std::make_unique
-- filesystem implementation ....... : std::filesystem
-- format implementation ........... : fmt::format
-- thread_local support? ........... : TRUE
-- Applications required for tests:
-- zip ............................. : /usr/bin/zip
-- sed ............................. : /usr/bin/sed
-- gzip ............................ : /usr/bin/gzip
-- Available appenders:
-- Async Appender .................. : ON
-- ODBC Appender ................... : OFF
-- DB Appender ..................... : ON
-- SMTP Appender ................... : OFF
-- XMLSocketAppender ............... : ON
-- SocketHubAppender ............... : ON
-- SyslogAppender .................. : ON
-- Using syslog.h .................. : ON
-- TelnetAppender .................. : ON
-- NTEventLogAppender .............. : OFF
-- OutputDebugStringAppender ....... : ON
-- ConsoleAppender ................. : ON
-- FileAppender .................... : ON
-- RollingFileAppender ............. : ON
-- MultiprocessRollingFileAppender . : OFF
-- Available layouts:
-- HTMLLayout ...................... : ON
-- JSONLayout ...................... : ON
-- PatternLayout ................... : ON
-- SimpleLayout .................... : ON
-- XMLLayout ....................... : ON
-- FMTLayout ....................... : OFF
-- Configuring done
-- Generating done

make output:
...
[ 46%] Linking CXX shared library liblog4cxx.so
cd /home/clobo/log4cxx/apache-log4cxx-1.2.0/build/src/main/cpp && /usr/bin/cmake -E cmake_link_script CMakeFiles/log4cxx.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -shared -Wl,-soname,liblog4cxx.so.15 -o liblog4cxx.so.15.2.0 CMakeFiles/log4cxx.dir/action.cpp.o CMakeFiles/log4cxx.dir/andfilter.cpp.o CMakeFiles/log4cxx.dir/appenderattachableimpl.cpp.o CMakeFiles/log4cxx.dir/appenderskeleton.cpp.o CMakeFiles/log4cxx.dir/aprinitializer.cpp.o CMakeFiles/log4cxx.dir/asyncappender.cpp.o CMakeFiles/log4cxx.dir/basicconfigurator.cpp.o CMakeFiles/log4cxx.dir/bufferedwriter.cpp.o CMakeFiles/log4cxx.dir/bytearrayinputstream.cpp.o CMakeFiles/log4cxx.dir/bytearrayoutputstream.cpp.o CMakeFiles/log4cxx.dir/bytebuffer.cpp.o CMakeFiles/log4cxx.dir/cacheddateformat.cpp.o CMakeFiles/log4cxx.dir/charsetdecoder.cpp.o CMakeFiles/log4cxx.dir/charsetencoder.cpp.o CMakeFiles/log4cxx.dir/class.cpp.o CMakeFiles/log4cxx.dir/classnamepatternconverter.cpp.o CMakeFiles/log4cxx.dir/classregistration.cpp.o CMakeFiles/log4cxx.dir/colorstartpatternconverter.cpp.o CMakeFiles/log4cxx.dir/colorendpatternconverter.cpp.o CMakeFiles/log4cxx.dir/configurator.cpp.o CMakeFiles/log4cxx.dir/consoleappender.cpp.o CMakeFiles/log4cxx.dir/cyclicbuffer.cpp.o CMakeFiles/log4cxx.dir/date.cpp.o CMakeFiles/log4cxx.dir/dateformat.cpp.o CMakeFiles/log4cxx.dir/datepatternconverter.cpp.o CMakeFiles/log4cxx.dir/dbappender.cpp.o CMakeFiles/log4cxx.dir/defaultconfigurator.cpp.o CMakeFiles/log4cxx.dir/defaultloggerfactory.cpp.o CMakeFiles/log4cxx.dir/defaultrepositoryselector.cpp.o CMakeFiles/log4cxx.dir/exception.cpp.o CMakeFiles/log4cxx.dir/fallbackerrorhandler.cpp.o CMakeFiles/log4cxx.dir/file.cpp.o CMakeFiles/log4cxx.dir/fileappender.cpp.o CMakeFiles/log4cxx.dir/filedatepatternconverter.cpp.o CMakeFiles/log4cxx.dir/fileinputstream.cpp.o CMakeFiles/log4cxx.dir/filelocationpatternconverter.cpp.o CMakeFiles/log4cxx.dir/fileoutputstream.cpp.o CMakeFiles/log4cxx.dir/filerenameaction.cpp.o CMakeFiles/log4cxx.dir/filewatchdog.cpp.o CMakeFiles/log4cxx.dir/filter.cpp.o CMakeFiles/log4cxx.dir/filterbasedtriggeringpolicy.cpp.o CMakeFiles/log4cxx.dir/fixedwindowrollingpolicy.cpp.o CMakeFiles/log4cxx.dir/formattinginfo.cpp.o CMakeFiles/log4cxx.dir/fulllocationpatternconverter.cpp.o CMakeFiles/log4cxx.dir/gzcompressaction.cpp.o CMakeFiles/log4cxx.dir/hexdump.cpp.o CMakeFiles/log4cxx.dir/hierarchy.cpp.o CMakeFiles/log4cxx.dir/htmllayout.cpp.o CMakeFiles/log4cxx.dir/inetaddress.cpp.o CMakeFiles/log4cxx.dir/inputstream.cpp.o CMakeFiles/log4cxx.dir/inputstreamreader.cpp.o CMakeFiles/log4cxx.dir/integer.cpp.o CMakeFiles/log4cxx.dir/integerpatternconverter.cpp.o CMakeFiles/log4cxx.dir/jsonlayout.cpp.o CMakeFiles/log4cxx.dir/layout.cpp.o CMakeFiles/log4cxx.dir/level.cpp.o CMakeFiles/log4cxx.dir/levelmatchfilter.cpp.o CMakeFiles/log4cxx.dir/levelpatternconverter.cpp.o CMakeFiles/log4cxx.dir/levelrangefilter.cpp.o CMakeFiles/log4cxx.dir/linelocationpatternconverter.cpp.o CMakeFiles/log4cxx.dir/lineseparatorpatternconverter.cpp.o CMakeFiles/log4cxx.dir/literalpatternconverter.cpp.o CMakeFiles/log4cxx.dir/loader.cpp.o CMakeFiles/log4cxx.dir/locale.cpp.o CMakeFiles/log4cxx.dir/locationinfo.cpp.o CMakeFiles/log4cxx.dir/locationinfofilter.cpp.o CMakeFiles/log4cxx.dir/logger.cpp.o CMakeFiles/log4cxx.dir/loggermatchfilter.cpp.o CMakeFiles/log4cxx.dir/loggerpatternconverter.cpp.o CMakeFiles/log4cxx.dir/loggingevent.cpp.o CMakeFiles/log4cxx.dir/loggingeventpatternconverter.cpp.o CMakeFiles/log4cxx.dir/loglog.cpp.o CMakeFiles/log4cxx.dir/logmanager.cpp.o CMakeFiles/log4cxx.dir/logstream.cpp.o CMakeFiles/log4cxx.dir/manualtriggeringpolicy.cpp.o CMakeFiles/log4cxx.dir/mapfilter.cpp.o CMakeFiles/log4cxx.dir/mdc.cpp.o CMakeFiles/log4cxx.dir/messagebuffer.cpp.o CMakeFiles/log4cxx.dir/messagepatternconverter.cpp.o CMakeFiles/log4cxx.dir/methodlocationpatternconverter.cpp.o CMakeFiles/log4cxx.dir/nameabbreviator.cpp.o CMakeFiles/log4cxx.dir/namepatternconverter.cpp.o CMakeFiles/log4cxx.dir/ndc.cpp.o CMakeFiles/log4cxx.dir/mdcpatternconverter.cpp.o CMakeFiles/log4cxx.dir/ndcpatternconverter.cpp.o CMakeFiles/log4cxx.dir/nteventlogappender.cpp.o CMakeFiles/log4cxx.dir/odbcappender.cpp.o CMakeFiles/log4cxx.dir/onlyonceerrorhandler.cpp.o CMakeFiles/log4cxx.dir/optionconverter.cpp.o CMakeFiles/log4cxx.dir/outputdebugstringappender.cpp.o CMakeFiles/log4cxx.dir/outputstream.cpp.o CMakeFiles/log4cxx.dir/outputstreamwriter.cpp.o CMakeFiles/log4cxx.dir/patternconverter.cpp.o CMakeFiles/log4cxx.dir/patternlayout.cpp.o CMakeFiles/log4cxx.dir/patternparser.cpp.o CMakeFiles/log4cxx.dir/pool.cpp.o CMakeFiles/log4cxx.dir/properties.cpp.o CMakeFiles/log4cxx.dir/propertiespatternconverter.cpp.o CMakeFiles/log4cxx.dir/propertyconfigurator.cpp.o CMakeFiles/log4cxx.dir/propertyresourcebundle.cpp.o CMakeFiles/log4cxx.dir/propertysetter.cpp.o CMakeFiles/log4cxx.dir/reader.cpp.o CMakeFiles/log4cxx.dir/relativetimedateformat.cpp.o CMakeFiles/log4cxx.dir/relativetimepatternconverter.cpp.o CMakeFiles/log4cxx.dir/resourcebundle.cpp.o CMakeFiles/log4cxx.dir/rollingfileappender.cpp.o CMakeFiles/log4cxx.dir/rollingpolicy.cpp.o CMakeFiles/log4cxx.dir/rollingpolicybase.cpp.o CMakeFiles/log4cxx.dir/rolloverdescription.cpp.o CMakeFiles/log4cxx.dir/rootlogger.cpp.o CMakeFiles/log4cxx.dir/shortfilelocationpatternconverter.cpp.o CMakeFiles/log4cxx.dir/simpledateformat.cpp.o CMakeFiles/log4cxx.dir/simplelayout.cpp.o CMakeFiles/log4cxx.dir/sizebasedtriggeringpolicy.cpp.o CMakeFiles/log4cxx.dir/smtpappender.cpp.o CMakeFiles/log4cxx.dir/strftimedateformat.cpp.o CMakeFiles/log4cxx.dir/stringhelper.cpp.o CMakeFiles/log4cxx.dir/stringmatchfilter.cpp.o CMakeFiles/log4cxx.dir/stringtokenizer.cpp.o CMakeFiles/log4cxx.dir/system.cpp.o CMakeFiles/log4cxx.dir/systemerrwriter.cpp.o CMakeFiles/log4cxx.dir/systemoutwriter.cpp.o CMakeFiles/log4cxx.dir/threadlocal.cpp.o CMakeFiles/log4cxx.dir/threadpatternconverter.cpp.o CMakeFiles/log4cxx.dir/threadusernamepatternconverter.cpp.o CMakeFiles/log4cxx.dir/threadspecificdata.cpp.o CMakeFiles/log4cxx.dir/threadutility.cpp.o CMakeFiles/log4cxx.dir/throwableinformationpatternconverter.cpp.o CMakeFiles/log4cxx.dir/timebasedrollingpolicy.cpp.o CMakeFiles/log4cxx.dir/timezone.cpp.o CMakeFiles/log4cxx.dir/transcoder.cpp.o CMakeFiles/log4cxx.dir/transform.cpp.o CMakeFiles/log4cxx.dir/triggeringpolicy.cpp.o CMakeFiles/log4cxx.dir/writer.cpp.o CMakeFiles/log4cxx.dir/writerappender.cpp.o CMakeFiles/log4cxx.dir/xmllayout.cpp.o CMakeFiles/log4cxx.dir/zipcompressaction.cpp.o CMakeFiles/log4cxx.dir/datagrampacket.cpp.o CMakeFiles/log4cxx.dir/datagramsocket.cpp.o CMakeFiles/log4cxx.dir/aprdatagramsocket.cpp.o CMakeFiles/log4cxx.dir/serversocket.cpp.o CMakeFiles/log4cxx.dir/aprserversocket.cpp.o CMakeFiles/log4cxx.dir/socket.cpp.o CMakeFiles/log4cxx.dir/aprsocket.cpp.o CMakeFiles/log4cxx.dir/telnetappender.cpp.o CMakeFiles/log4cxx.dir/socketappenderskeleton.cpp.o CMakeFiles/log4cxx.dir/socketoutputstream.cpp.o CMakeFiles/log4cxx.dir/xmlsocketappender.cpp.o CMakeFiles/log4cxx.dir/syslogwriter.cpp.o CMakeFiles/log4cxx.dir/syslogappender.cpp.o CMakeFiles/log4cxx.dir/domconfigurator.cpp.o /usr/lib/x86_64-linux-gnu/libaprutil-1.so /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/x86_64-linux-gnu/libapr-1.a -lpthread
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libapr-1.a(open.o): warning: relocation against apr_unix_child_file_cleanup' in read-only section .text'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libapr-1.a(proc_mutex.o): relocation R_X86_64_PC32 against symbol `apr_proc_mutex_cleanup' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:2502: src/main/cpp/liblog4cxx.so.15.2.0] Error 1
make[2]: Leaving directory '/home/clobo/log4cxx/apache-log4cxx-1.2.0/build'
make[1]: *** [CMakeFiles/Makefile2:1366: src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
make[1]: Leaving directory '/home/clobo/log4cxx/apache-log4cxx-1.2.0/build'
make: *** [Makefile:146: all] Error 2

Visual Studio compiler warning C4100

Visual Studio reports warning C4100 when compiling code that includes log4cxx/spi/loggerrepository.h.

That function has two functions with empty bodies (fireAddAppenderEvent, fireRemoveAppenderEvent). Because they have unused formal parameters, Visual Studio warns about "unreferenced formal parameter".

Logging overhead due to unnecessary pessimism

AppenderAttachableImpl::appendLoopOnAppenders locks a mutex for every Logger in the path to the root Logger.

Logging overhead would be reduced significantly if AppenderAttachableImpl was immutable.

Some thread errors when user user send signals to application

Hello!
First of all thanks to everybody who contributed to this great project! I really appreciate that.

So, I have used log4cxx 0.11.0 in my application (running on FreeBSD 13.0 amd64), and just recently updated my application to use log4cxx 1.0.0 (with no change in my code and config). Everything looks fine which is amazing, however I noticed when user sends USR1 or USR2 signals or when application is getting exit there will be always some thread errors appears :

__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping
__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping
__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping
__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping
__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping
__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping
__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping
__cxa_thread_call_dtors: dtr 0x803f37850 from unloaded dso, skipping

Could anybody help me with this ?

So, my usage from log4cxx is quite basic. I've multithreaded application, and use several global logger objects for logging information into log files.

log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("_logger1"));
log4cxx::LoggerPtr _ss_logger(log4cxx::Logger::getLogger("_logger2"));
log4cxx::LoggerPtr _misc_logger(log4cxx::Logger::getLogger("_logger3"));

My configuration is stored in a .XML file and have created 3 RollingFileAppender with respective category to let each logger objects in my code to point to its specified config.

Create basic documentation on using Log4cxx in your projects

There is currently some information in the documentation about how to use in your projects, but there's nothing along the lines of "copy and paste this into your buildsystem."

Perhaps adding a standalone project into the examples folder would be good.

SetThreadDescription and GetThreadDescription are not properly linked on Windows

In order to be used on Windows Server, the SetThreadDescription() and GetThreadDescription() functions need to be linked at run time, instead of at load time.

The code as implemented works on Windows 10 (and I assume on Windows 11), but fails on Windows Server (I have tested 2016, but not any other Server versions).

I have worked around this issue by disabling the symbol checks in CMakeLists.txt.

Error when Cross-compiling library for ARMv7l

I'm trying to cross compile the log4cxx lib for an armv7l arch.

Steps to reproduce:

Install the cross tolchain arm-linux-gnueabi

sudo apt install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi binutils-arm-linux-gnueabi

Start some env variables to hold directores

export DIR_TARGET=/data/marthe/usr
export DIR_HOST=$HOME/project/lib/expat

Expat dependency library

wget https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.gz
## Extract the source code
tar -xvf expat-2.5.0.tar.gz
cd expat-2.5.0

Configuring

./configure \
--build=i686-pc-linux-gnu \
--host=arm-linux-gnueabi \
--prefix=$DIR_HOST \
--exec-prefix=$DIR_HOST \
STRIP="/usr/bin/arm-linux-gnueabi-strip" \
AR="/usr/bin/arm-linux-gnueabi-ar" \
CC="/usr/bin/arm-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=softfp -mfpu=neon" \
CXX="/usr/bin/arm-linux-gnueabi-g++ -march=armv7-a -mfloat-abi=softfp -mfpu=neon" \
CFLAGS="-O3 -fexpensive-optimizations -frename-registers -fomit-frame-pointer" \
CXXFLAGS="-O3 -fexpensive-optimizations -frename-registers -fomit-frame-pointer" \
LDFLAGS="-Wl,--strip-all -Wl,--rpath=$DIR_TARGET/lib -Wl,--dynamic-linker=$DIR_TARGET/lib/ld-linux.so.3 -Wl,-O3 -Wl,--hash-style=gnu -Wl,--as-needed" \
CPP="/usr/bin/arm-linux-gnueabi-gcc -E -march=armv7-a -mfloat-abi=softfp -mfpu=neon" \
CXXCPP="/usr/bin/arm-linux-gnueabi-g++ -E -march=armv7-a -mfloat-abi=softfp -mfpu=neon" \
STRIP="/usr/bin/arm-linux-gnueabi-strip" \
OBJDUMP="/usr/bin/arm-linux-gnueabi-objdump"

make -j4 

make install

Log4cxx instalation

Downloading and extracting source code

wget https://dlcdn.apache.org/logging/log4cxx/1.0.0/apache-log4cxx-1.0.0.tar.gz
tar -xvf apache-log4cxx-1.0.0.tar.gz
cd  apache-log4cxx-1.0.0

Configuring

cmake -Bbuild -H. \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=$HOME/project/lib/log4cxx \
  -DCMAKE_TOOLCHAIN_FILE=$HOME/project/cmake/toolchain-arm-linux-gnueabi.cmake \
  -DBUILD_TESTING=off \
  -DBUILD_SHARED_LIBS=off \
  -DEXPAT_LIBRARY=$HOME/project/lib/expat/lib \
  -DEXPAT_INCLUDE_DIR=$HOME/project/lib/expat/include \
  -G "Unix Makefiles"

Error from configuration step

-- Available appenders:
--   Async Appender .................. : ON
--   ODBC Appender ................... : OFF
--   SMTP Appender ................... : OFF
--   XMLSocketAppender ............... : ON
--   SocketHubAppender ............... : ON
--   SyslogAppender .................. : ON
--   TelnetAppender .................. : ON
--   NTEventLogAppender .............. : OFF
--   OutputDebugStringAppender ....... : ON
--   ConsoleAppender ................. : ON
--   FileAppender .................... : ON
--   RollingFileAppender ............. : ON
--   MultiprocessRollingFileAppender . : OFF
-- Available layouts:
--   HTMLLayout ...................... : ON
--   JSONLayout ...................... : ON
--   PatternLayout ................... : ON
--   SimpleLayout .................... : ON
--   XMLLayout ....................... : ON
--   FMTLayout ....................... : OFF
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/home/lincoln/cross_compile/source/apache-log4cxx-1.0.0/src/APR_INCLUDE_DIR
   used as include directory in directory /home/lincoln/cross_compile/source/apache-log4cxx-1.0.0/src/main/cpp
/home/lincoln/cross_compile/source/apache-log4cxx-1.0.0/src/APR_UTIL_INCLUDE_DIR
   used as include directory in directory /home/lincoln/cross_compile/source/apache-log4cxx-1.0.0/src/main/cpp

-- Configuring incomplete, errors occurred!
See also "/home/lincoln/cross_compile/source/apache-log4cxx-1.0.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/lincoln/cross_compile/source/apache-log4cxx-1.0.0/build/CMakeFiles/CMakeError.log".

these are the log files of the errors:

CMakeError.log
CMakeOutput.log

Add option to disable DOMConfigurator

We already have some support for disabling network support(which depends on APR), the other thing that depends on APR is the XML parsing. By making the XML parsing optional, we should be able to make most of the log4cxx code APR-optional.

Extra semicolons in include/log4cxx/pattern/patternconverter.h

When compiled with -Wpedantic, g++ complains of extra semicolons in include/log4cxx/pattern/patternconverter.h in this section:

		DECLARE_LOG4CXX_PATTERN(PatternConverter);
		BEGIN_LOG4CXX_CAST_MAP();
		LOG4CXX_CAST_ENTRY(PatternConverter);
		END_LOG4CXX_CAST_MAP();

since the defines already include semicolons.

Remove special characters in log file.

Hello.

Thank you for the library. How can I filter special characters in FileAppender? I am using special characters (colors) to represent different levels of logs and I don't want them to be printed to the log file.

Delay/pause/crash in LogManager::shutdown()

Can't provide any simple app to reproduce the issue, but getting it frequently enough in production multi-thread code during LogManager::shutdown() call before main.cpp exit (nothing is running at this moment). Using 1.2.0 version.
Very often see some strange delay ~1-30 seconds, sometimes up to 30 minutes. Sometimes crashed with ACCESS_VIOLATION message.
In Process Explorer I saw some function with 0x0000000 address (disappeared quickly). Core dump was absolutely not helpful.
Used logging is trivial enough - console low intensive output only.

Ability to remove a HierarchyEventListener?

Hierarchy::addHierarchyEventListener allows to register a listener to intercept the appenders additions to a logger.
But there is no way to remove a listener, for example because its lifetime isn't the same as the logger (when we do it to Logger::getRootLogger()->getLoggerRepository()). True, or do I miss something?

If true, I'd like to have a Hierarchy::removeHierarchyEventListener.

Add flowchart on how messages are logged

It would be useful to have a flowchart on how messages are logged, so that it is easy to see in a visual manner the decision on if a message is to be logged or not.

The flow is fairly basic most of the time, only checking to see what the level is and then checking any/all available filters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.