The purpose of this project is to port the excellent Log for Java (log4j) logging library to C++.
See all
Members (49)
log4cplus's profile photo
abdul samad's profile photo
陶金秋's profile photo
Ashwin D's profile photo
Auction markete's profile photo
BHASKARADS's profile photo
Saurabh Banethia's profile photo
christopher dawes's profile photo
DrDoom77's profile photo
Václav Haisman's profile photo
Géry Vessère's profile photo
Viraj Shirgaonkar's profile photo
Jim Hague's profile photo
Kyle Leber's profile photo
Linus Lirpa (Tobias W.)'s profile photo
Maria Vineeta's profile photo
Martin Runge's profile photo
Yin laiyier's profile photo
Musten Jiruwala's profile photo
Subhamoy Sengupta's profile photo
Nouri Marwen's profile photo
Ryan Thompson's profile photo
Sergei Nikulov's profile photo
Robert Reynolds's profile photo

Stream

Join this community to post or comment
 
Documentation of log4cplus is very weak. However there some examples in order to shallowly use it but I couldn't find any deep information about the library. For instance, "spi" namespace and classes in this namespace are very blurry. One can understand it by investigating the code but it takes more time. Do you know any detailed tutorial or document for log4cplus ?
1
1
Václav Haisman's profile photo
Add a comment...

Ashwin D

Diskuse  - 
 
i had generated liblog4cplus.a static library, i tried using the same with necessary libs in my project. It throws log4cplusinitialize referenced symbol not found... And while creating a my .so along with static log4cplus.a lib, i got a ld:warning like " loblog4cplus.configurator" wrong ELFCLASS 32..Do i need to create 64 bit lib, if any suggestions how to do it.... if not what mite be the above error(referenced symbol not found) due to?  any idea.. 
1
Václav Haisman's profile photoAshwin D's profile photo
2 comments
 
Nothing!!. Actuallt i had configured the download wirh the following: " Configure --enable-static. And i done "make" and  i got the liblog4cplus.a file, which i want to use in my project as a static link library. While doing that i got ELFCLASS32 warning, so i wanted to make the library as compatible for 64 bit.. i am sorry if i confused you. Any idea on that..Or do u require myy config files....
Add a comment...

Ashwin D

Diskuse  - 
 
Hi , I want to use log4cplus for a c++ project in solaris. What do i need to do first? 
1
Václav Haisman's profile photoAshwin D's profile photo
7 comments
 
+Václav Haisman sure...
Add a comment...
 
Is there an Ubuntu repository, from where I can get the latest and greatest of this? The version in the Trusty Canonical repos is too old.
1
Václav Haisman's profile photo
 
As far as I know, there is not any. 
Add a comment...

log4cplus
owner

Diskuse  - 
 
 
*log4cplus 1.2.0-RC3 released*

- Fixed various issues related to unspecified behaviors which manifested when log4cplus was compiled using Clang.
SysLogAppender now recognize SyslogHost property as synonym for host property.

- Improved compatibility of TTCCLayout with log4j's. Added ThreadPrinting, CategoryPrefixing and ContextPrinting configuration properties.

- Allow negative maximal length in pattern specifier to make trimming of end instead of beginning possible. E.g., allow %.-1p to get initial letters of log level.

- New appender TimeBasedRollingFileAppender. (Alexander Malinin)
LOG4CPLUS_*_FMT() macros can now be invoked with just formatting string, without additional arguments. (Zhang Shengfa)

- Insert to/from string/log level conversion functions to the beginning of vector to favour user defined log levels and conversion functions.
View original post
1
Add a comment...

Kyle Leber

Diskuse  - 
 
Does the log4cplus pattern layout support the use of a log level initial instead of the full word?  Basically I'm looking to output E, W, I, D, or T for Error, Warn, Info, Debug, or Trace.
1
Václav Haisman's profile photoKyle Leber's profile photo
4 comments
 
Great thanks!
Add a comment...

Roger Yang

Diskuse  - 
 
Build failure after removed -DLOG4CPLUS_SINGLE_THREADED="TRUE" to support multi-thread on iOS
/Users/rogery/Project/cwme/vendor/log4cplus/include/log4cplus/internal/internal.h:143:8: error: thread-local storage is unsupported for the current target
extern LOG4CPLUS_THREAD_LOCAL_VAR per_thread_data * ptd;
1
Václav Haisman's profile photo
 
This means that iOS/ConfigureChecks.cmake file defines LOG4CPLUS_THREAD_LOCAL_VAR even though iOS does not support the __thread keyword. If that is true, I cannot verify it, then both of the lines in the iOS/ConfigureChecks.cmake file, related to the TLS, should be removed.
Add a comment...

Roger Yang

Diskuse  - 
 
Our android project set APP_STL as c++_shared, if I want to use Log4cplus in this project, then I think I need to build Log4cplus with ANDROID_STL:STRING=c++_shared, but cmake don't support this now, is there any way I can work around this?
1
Václav Haisman's profile photo
 
+Roger Yang Personally, I have no idea. Maybe +Nikita Manovich does know how to deal with this?
Add a comment...

Fu Jiantao

Diskuse  - 
 
How to disable using soname in Android? I found the solution herehttp://www.cmake.org/Bug/view.php?id=14602, but failed to do this, I created Linux.cmake, but the CMAKE_MODULE_PATH is seems not working, and i tried set this in toolchain and CMakeLists.txt.

Changing the Linux.cmake in  /Applications/CMake\ 2.8-12.app/Contents/share/cmake-2.8/Modules/Platform works for me.

I'm wondering is there any solution other than that exists for this because Android doesn't support soname?

Thanks!
1
Fu Jiantao's profile photo
7 comments
 
+Václav Zeman

Removing the 'VERSION "${log4cplus_version_major}.${log4cplus_version_minor}.${log4cplus_version_patch}"' line from the true branch of the if (ANDROID)

works!

Thanks a lot!
Add a comment...

Fu Jiantao

Diskuse  - 
 
Wondering how LOG4CPLUS_EXPORT works in Android, i encounter an error when linking the log4cplus library, and the error is:

error: undefined reference to 'log4cplus::FileAppender::FileAppender(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, bool, bool)'

Using nm i can see the symbol is there, don't know why link failed, and i check the source code find that FileAppender is not defined with LOG4CPLUS_EXPORT, while RollingFileAppender is, so i switched using RollingFileAppender and everything works fine now.

My question is: How the exporting works? I see in config.hxx

#  if defined (INSIDE_LOG4CPLUS)
#    define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_EXPORT
#  else
#    define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_IMPORT
#  endif // defined (INSIDE_LOG4CPLUS)

#ifndef LOG4CPLUS_DECLSPEC_EXPORT
#define LOG4CPLUS_DECLSPEC_EXPORT /* empty */
#endif

I know that there may be some way to do this like _attribute_((visibility("hidden"))), but i haven't find any .

What is the magic here?

Thanks in advance!
1
Fu Jiantao's profile photo
3 comments
 
+Václav Zeman

The problem is solved, it is caused by using different stl library. Sepcifiy stlport_shared fix the issue.

cmake -DCMAKE_TOOLCHAIN_FILE=../../android/android.toolchain.cmake -DUNICODE:BOOL=OFF -DANDROID_STL:STRING=stlport_shared -DANDROID_NATIVE_API_LEVEL:STRING=9 -DANDROID_FUNCTION_LEVEL_LINKING:BOOL=OFF  -DCMAKE_BUILD_TYPE=Release ../../
Add a comment...

Kyle Leber

Diskuse  - 
 
Does log4cplus support variadic 'printf' style logging or only the C++ '<<' operator?
1
Václav Haisman's profile photoKyle Leber's profile photo
2 comments
 
Perfect! Thanks for the quick response.
Add a comment...

Created by

About this community

log4cplus is a simple to use C++ logging API providing thread-safe, flexible, and arbitrarily granular control over log management and configuration. It is modelled after the Java log4j API.

Ashwin D

Diskuse  - 
 
Is it possible to create Log4cplus as s static library... While configuring, i mentioned --enable-static.. But its not creating .a file, rather again creating so files. Is any other way to create as a static library. 
1
Ashwin D's profile photoVáclav Haisman's profile photo
3 comments
 
+Ashwin D That might be the problem. Can you post config.log for somewhere for inspection or send it to my email vhaisman@gmail.com, if you want to keep it private.
Add a comment...
 
Hi,

why do i need the log4cplus.dll in my folders?
Can i compile the Sourcecode that i doesn't need the dll?
1
Tobias Dornheim's profile photoVáclav Haisman's profile photo
3 comments
 
Your code needs to define LOG4CPLUS_STATIC preprocessor symbol. Do not forget to set up includes and libraries paths and/or add log4cplusS to your projects References.
Add a comment...

log4cplus
owner

Diskuse  - 
 
 
log4cplus 1.1.3-RC4 released

- Allow negative maximal length in pattern specifier to make trimming of end instead of beginning possible. E.g., allow %.-1p to get initial letters of log level.

- Visual Studio DLL builds now have a resource with basic information about the library. (Oskari Timperi)

- LOG4CPLUS_*_FMT() macros can now be invoked with just formatting string, without additional arguments. (Zhang Shengfa)

- Added setCurrentThreadName() and setCurrentThreadName2() to allow setting current thread name to custom string instead of the default stringified thread ID. (Zhang Shengfa)
View original post
1
Add a comment...
 
We have integrated this simple to use log4cplus in Adone InDesign CC (an application) using PlugIns on Mac as well as Windows. However, InDesign needs to be started in Admin mode for RollingFileAppender to be able to create the log file. I would like this to be created without having to start the application in Admin mode. How do I achieve this? Thank you for your help in advance.
1
Václav Haisman's profile photoMusten Jiruwala's profile photo
4 comments
 
Cool. Thank you very much for information.
Add a comment...
 
I am trying to compile some of my old software, where I had used Log4CPlus. I found it like this in CMake:

find_path(LOG4CPLUS_INCLUDE_DIRS log4cplus/logger.h
          HINTS "/usr/include/" "/usr/local/include/"
          PATH_SUFFIXES log4cplus )

find_library(LOG4CPLUS_LIBS NAMES liblog4cplus.a liblog4cplus.la liblog4cplus.so
             HINTS "/usr/lib/" "/usr/local/lib"
             PATH_SUFFIXES x86_64-linux-gnu )

I am trying to compile the code again, and I just installed the 1.0.4 version from the repos. CMake does not complain, but Make fails afterwards with this error:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/liblog4cplus.a(logger.o): relocation R_X86_64_32S against `_ZTVN9log4cplus6LoggerE' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/liblog4cplus.a: error adding symbols: Bad value

I am suing Ubuntu Trusty, GCC 4.9.1. Am I doing something wrong? How do I do it right?
1
Václav Haisman's profile photoSubhamoy Sengupta's profile photo
2 comments
 
I have removed all static archives. My idea was to give someone the binary, who would not take the trouble of finding and installing the right versions of everything. But I will find another way :) Thank you! I still make silly mistakes with CMake sometimes.
Add a comment...

log4cplus
owner

Diskuse  - 
 
 
log4cplus 1.2.0-RC2 released

I have released log4cplus 1.2.0-RC2. It contains only a small amount of changes relative to the previous 1.2.0-RC1 release:

- Fixed bug #298. -- int to pointer cast error on Xcode 5.1.

- Updated android/android.toolchain.cmake.

- Documented issue and work-around for Android's emutls issue.

- Do not set SOVERSION and VERSION properties for CMake based Android builds.

#log4cplus  
View original post
1
Add a comment...

Roger Yang

Diskuse  - 
 
Do any one know how to disable c++ 11 support when build log4cplus on iOS?
1
Roger Yang's profile photoVáclav Haisman's profile photo
5 comments
 
+Roger Yang With CMake, try to set the switch in CMAKE_CXX_FLAGS on CMake's command line: -D CMAKE_CXX_FLAGS:STRING="-std=c++98"
Add a comment...

Fu Jiantao

Diskuse  - 
 
Hi, the android tool chain has already updated, and we should update the toolchain file used in log4cplus.

Updated to the newest version  https://github.com/taka-no-me/android-cmake solved the following issue 

engyu:android pengyu$ cmake -DCMAKE_TOOLCHAIN_FILE=../../android/android.toolchain.cmake -DUNICODE:BOOL=OFF -DANDROID_STL:STRING=stlport_shared -DANDROID_NATIVE_API_LEVEL:STRING=9 -DCMAKE_BUILD_TYPE=Release -DANDROID_FUNCTION_LEVEL_LINKING:BOOL=OFF ../../ --debug-output
Running with debug output on.
Error copying file (if different) from "/Users/pengyu/data/android/ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_shared.so" to "/libstlport_shared.so".
android-cmake - CMake scripts and patches for libraries using CMake and the Android NDK
1
Václav Haisman's profile photoMichael Seare's profile photo
4 comments
 
I think you're right Vaclav.  When I pulled a clean version of log4cplus and went directly to using CMake in the Android folder with the parameters used by Fu Jiantao above, I got further along.
Add a comment...

Fu Jiantao

Diskuse  - 
 
Compile in Android for Release version encounter error. Debug version works fine.

cmake -DCMAKE_TOOLCHAIN_FILE=../../android/android.toolchain.cmake -DUNICODE:BOOL=OFF -DCMAKE_BUILD_TYPE=Release ../../

I'm using 1.2.0-rc1, and using cmake 

"/Users/jeromy/work/cisco/temp/log4cplus-release/log4cplus-1.2.0-rc1/src/global-init.cxx:268:46: error: log4cplus::internal::__emutls_t._ZN9log4cplus8internal3ptdE causes a section type conflict"

Any ideas? Thanks!
1
Premalatha Ramprasad's profile photoVáclav Haisman's profile photo
7 comments
 
+Premalatha Ramprasad Is your question also Android related? In either case, I have never seen this kind of diference between release and debug versions. Please fill a complete bug report together with a self contained test-case. 
Add a comment...