The purpose of this project is to port the excellent Log for Java (log4j) logging library to C++.
See all
Members (47)
log4cplus's profile photo
Subhamoy Sengupta's profile photo
Yin laiyier's profile photo
Auction markete's profile photo
BHASKARADS's profile photo
Cen Rao's profile photo
DrDoom77's profile photo
Fu Jiantao's profile photo
christopher dawes's profile photo
Ichiro Kuroki's profile photo
Jim Hague's profile photo
Kyle Leber's profile photo
Linus Lirpa (Tobias W.)'s profile photo
Václav Haisman's profile photo
Viraj Shirgaonkar's profile photo
Saurabh Banethia's profile photo
Musten Jiruwala's profile photo
Myeong-Ho AN's profile photo
Nouri Marwen's profile photo
Peace Da's profile photo
Premalatha Ramprasad's profile photo
Robert Reynolds's profile photo
Ryan Thompson's profile photo
Sarvagya Pant's profile photo

Stream

Join this community to post or comment
 
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...

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...
 
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...
 
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...
 
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...
 
Error in compiling log4cplus for Android, remove std:: prefix can fix the error. And should use toolchain arm-linux-androideabi-4.8, arm-linux-androideabi-4.6 has lots of compile issues.

log4cplus/src/snprintf.cxx: In function 'int log4cplus::helpers::{anonymous}::vsntprintf(log4cplus::tchar*, std::size_t, const tchar*, va_list)':
/Users/jeromy/work/cisco/temp/log4cplus/src/snprintf.cxx:57:11: error: 'vsnprintf' is not a member of 'std'
     ret = std::vsnprintf (dest, dest_size, fmt, args);
1
Fu Jiantao's profile photoVáclav Haisman's profile photo
7 comments
 
+Fu Jiantao Well, maybe. Is there any preprocessor symbol that defines Android version that Log4cplus could use to use alternative implementation of rw lock?
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.
 
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...

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...
 
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...
 
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...
 
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...
 
Does latest log4cplus on github require c++11? Seems it can't compile for vs 2008
1
Václav Haisman's profile photo
 
Yes, master branch is C++11 only. Do not use the master branch from github, it is where I do development. The latest stable branch is 1.2.0, use that.
Add a comment...
 
What would be the smart way of tracing the entry and exit for each method in an object? A method can check for many conditions and may have many return statements. Putting a trace log entry manually at each point does not seem very smart.

I have already gone through all the tests in the GitHub. I cannot see any example of TraceLogger in use.
1
Václav Haisman's profile photoSubhamoy Sengupta's profile photo
3 comments
 
This is fantastic :D Thank you!
Add a comment...