• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

android/H22-Oct-2013-1,7911,653

cygport/H22-Oct-2013-5947

docs/H03-May-2022-4,4763,316

include/H03-May-2022-13,4696,405

loggingserver/H03-May-2022-687563

m4/H22-Oct-2013-10,6399,595

msvc10/H22-Oct-2013-12,15312,151

qt4debugappender/H03-May-2022-818666

scripts/H22-Oct-2013-330253

src/H03-May-2022-15,80910,622

tests/H03-May-2022-11,0699,415

AUTHORSH A D01-Mar-20131.2 KiB2524

COPYINGH A D11-Apr-201022 21

ChangeLogH A D22-Oct-201310.3 KiB389217

ConfigureChecks.cmakeH A D11-Oct-201313.9 KiB383332

INSTALLH A D26-Apr-201215.4 KiB371289

LICENSEH A D11-Apr-201023.9 KiB453371

Log4CPlusCPack.cmakeH A D01-Mar-2013316 75

Log4CPlusUtils.cmakeH A D14-Mar-2013715 1816

Makefile.amH A D04-Jun-2012210 98

Makefile.inH A D03-May-202228.3 KiB872776

NEWSH A D12-Jul-2012102 32

READMEH A D06-Oct-201313 KiB397276

REVISIONH A D22-Oct-2013173 65

TODOH A D18-Dec-20121.1 KiB4124

acinclude.m4H A D09-Jun-2012647 1918

aclocal.m4H A D22-Oct-201336.1 KiB1,010923

ar-libH A D26-Apr-20125.7 KiB271210

config.guessH A D18-Dec-201243.9 KiB1,5381,331

config.subH A D18-Dec-201234.9 KiB1,7941,651

configureH A D22-Oct-2013709.2 KiB23,90519,994

configure.acH A D22-Oct-201321.5 KiB590493

depcompH A D18-Dec-201223.3 KiB788500

install-shH A D26-Apr-201213.7 KiB528351

log4cplus.pc.inH A D08-Mar-2011268 1412

log4cplus.specH A D29-May-20132.4 KiB8165

ltmain.shH A D02-Mar-2012276.8 KiB9,6567,304

mingw-log4cplus.specH A D10-Sep-20133.9 KiB12697

missingH A D26-Apr-20129.9 KiB331243

mkinstalldirsH A D26-Apr-20123.5 KiB163112

README

1% log4cplus README
2
3Short Description
4=================
5
6log4cplus is a simple to use C++ logging API providing thread-safe,
7flexible, and arbitrarily granular control over log management and
8configuration.  It is modeled after the Java log4j API.
9
10
11Latest Project Information
12==========================
13
14The latest up-to-date information for this project can be found at
15[log4cplus.sourceforge.net](http://log4cplus.sourceforge.net).  Please
16submit bugs, patches, feature requests, etc., there.
17
18
19Tested on the following platforms
20=================================
21
22- Linux/AMD64 with GCC 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
23- Linux/AMD64 with Sun C++ 5.12 Linux_i386 2011/11/16
24- Linux/AMD64 with Clang version 3.2-1~exp9ubuntu1
25  (tags/RELEASE_32/final) (based on LLVM 3.2)
26- Linux/AMD64 with Intel(R) C++ Intel(R) 64 Compiler XE for
27  applications running on Intel(R) 64, Version 12.1 Build 20120410
28- FreeBSD/AMD64 with GCC 3.4.6, 4.2.1 and 4.3.3
29- Windows 7 with MS Visual C++ 10.0
30- OpenSolaris 5.11 with Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21,
31  with -library=stlport4
32- Solaris 5.10 with Sun C++ 5.8 2005/10/13, with -library=stlport4
33- NetBSD 5.0.2/AMD64 with GCC 4.1.3 20080704 prerelease (NetBSD nb2
34  20081120)
35- OpenBSD 5.0/AMD64 with GCC 4.2.1 20070719
36- Haiku R1 Alpha 4.1 with GCC 4.6.3
37
38
39Configure script options
40========================
41
42`--enable-debugging`
43--------------------
44
45This option is disabled by default.  This option mainly affects GCC
46builds but it also has some limited effect on non-GCC builds.  It
47turns on debugging information generation, undefines `NDEBUG` symbol
48and adds `-fstack-check` (GCC).
49
50
51`--enable-warnings`
52-------------------
53
54This option is enabled by default.  It adds platform / compiler
55dependent warning options to compiler command line.
56
57
58`--enable-so-version`
59---------------------
60
61This option is enabled by default.  It enables SO version decoration
62on resulting library file, e.g., the `.2.0.0` in
63`liblog4cplus-1.2.so.2.0.0`.
64
65
66`--enable-release-version`
67--------------------------
68
69This option is enabled by default.  It enables release version
70decoration on the resulting library file, e.g., the `-1.2` in
71`liblog4cplus-1.2.so.2.0.0`.
72
73
74`--enable-profiling`
75--------------------
76
77This option is disabled by default.  This option adds profiling
78information generation compiler option `-pg` to GCC and Sun CC /
79Solaris Studio builds.
80
81
82`--enable-threads`
83------------------
84
85This option is enabled by default.  It turns on detection of necessary
86compiler and linker flags that enable POSIX threading support.
87
88While this detection usually works well, some platforms still need
89help with configuration by supplying additional flags to the configure
90script.  One of the know deficiencies is Solaris Studio on Linux.  See
91one of the later note for details.
92
93
94`--with-working-locale`
95-----------------------
96
97This is one of three locale and `wchar_t` <-> `char` conversion
98related options.  It is disabled by default.
99
100It is know to work well with GCC on Linux.  Other platforms generally
101have lesser locale support in their implementations of the C++
102standard library.  It is known not to work well on any BSDs.
103
104See also docs/unicode.txt.
105
106
107`--with-working-c-locale`
108-------------------------
109
110This is second of `wchar_t` <-> `char` conversion related options.  It
111is disabled by default.
112
113It is known to work well on most Unix--like platforms, including
114recent Cygwin.
115
116
117`--with-iconv`
118--------------
119
120This is third of `wchar_t` <-> `char` conversion related options.  It is
121disabled by default.
122
123The conversion using iconv() function always uses `"UTF-8"` and
124`"WCHAR_T"` as source/target encoding.  It is known to work well on
125platforms with GNU iconv.  Different implementations of `iconv()`
126might not support `"WCHAR_T"` encoding selector.
127
128Either system provided `iconv()` or library provided `libiconv()` are
129detected and accepted.  Also both SUSv3 and GNU `iconv()` function
130signatures are accepted.
131
132
133`--with-qt`
134-----------
135
136This option is disabled by default.  It enables compilation of a
137separate shared library (liblog4cplusqt4debugappender) that implements
138`Qt4DebugAppender`.  It requires Qt4 and pkg-config to be installed.
139
140
141Notes
142=====
143
144Cygwin/MinGW
145------------
146
147Some version of GCC (3.4.x and probably some of 4.x series too) on
148Windows (both Mingw and Cygwin) produces lots of warnings of the form:
149
150> warning: inline function 'void foo()' is declared as dllimport:
151  attribute ignored
152
153This can be worked around by adding `-Wno-attributes` option to GCC
154command.  Unfortunately, not all affected version of GCC have this
155option.
156
157
158MinGW and MSVCRT version
159------------------------
160
161log4cplus can use functions like `_vsnprintf_s()` (Microsoft's secure
162version of `vsnprintf()`). MinGW tool--chains (by default) link to the
163system MSVCRT.DLL. Unfortunately, older systems, like Windows XP, ship
164with MSVCRT.DLL that lacks these functions. It is possible to compile
165log4cplus with MinGW tool--chains but _without_ using the Microsoft's
166secure functions by defining `__MSVCRT_VERSION__` to value less than
167`0x900` and vice versa.
168
169    $ ../configure CPPFLAGS="-D__MSVCRT_VERSION__=0x700"
170
171
172Windows and TLS
173---------------
174
175log4cplus uses thread-local storage (TLS) for NDC, MDC and to optimize
176use of some temporary objects.  On Windows there are two ways to get
177TLS:
178
179(1) using `TlsAlloc()`, etc., functions
180(2) using `__declspec(thread)`
181
182While method (2) generates faster code, it has some limitations prior
183to Windows Vista.  If log4cplus.dll is loaded at run time using
184`LoadLibrary()` (or as a dependency of such loaded library), then
185accessing `__declspec(thread)` variables can cause general protection
186fault (GPF) errors.  This is because Windows prior to Windows Vista do
187not extend the TLS for libraries loaded at run time using
188LoadLibrary().  To allow using the best available method, log4cplus
189enables the method (2) by checking `_WIN32_WINNT >= 0x0600` condition,
190when compiling log4cplus targeted to Windows Vista or later.
191
192
193Threads and signals
194-------------------
195
196log4cplus is not safe to be used from asynchronous signals' handlers.
197This is a property of most threaded programmes in general.  If you are
198going to use log4cplus in threaded application and if you want to use
199log4cplus from signal handlers then your only option is to block
200signals in all threads but one that will handle all signals.  On POSIX
201platforms, this is possible using the `sigwait()` call.  log4cplus
202enables this approach by blocking all signals in any threads created
203through its threads helpers.
204
205
206IBM's XL C/C++ compiler
207-----------------------
208
209IBM's XL C/C++ compiler executable has [many variants][1].  To compile
210log4cplus with threading support specify one of the compiler variants
211that support threading using the `CXX` variable on configure script
212command line.  E.g.:
213
214    $ ../configure --enable-threads CXX=xlC_r
215
216[1]: http://pic.dhe.ibm.com/infocenter/comphelp/v121v141/index.jsp?topic=%2Fcom.ibm.xlcpp121.aix.doc%2Fcompiler_ref%2Ftucmpinv.html
217
218
219AIX reentrancy problem
220----------------------
221
222There appears to be a reentracy problem with AIX 5.3 and xlC 8 which
223can result into a deadlock condition in some circumstances.  It is
224unknown whether the problem manifests with other versions of either
225the OS or the compiler, too.  The problem was initially reported in a
226bug report [#103][2].
227
228The core of the problem is that IBM's/xlC's standard C++ IOStreams
229implementation uses global non recursive lock to protect some of its
230state.  The application in the bug report was trying to do logging
231using log4cplus from inside `overflow()` member function of a class
232derived from `std::streambuf` class.  log4cplus itself uses
233`std::ostringstream`.  This resulted into an attempt to recursively
234lock the global non recursive lock and a deadlock.
235
236[2]: http://sourceforge.net/p/log4cplus/bugs/103/
237
238
239Solaris / SunOS
240---------------
241
242Some older version of this operating system might have problems
243linking log4cplus due to [missing `__tls_get_addr`][3] in their
244unpatched state.
245
246[3]: https://groups.google.com/d/msg/comp.unix.solaris/AAMqkK0QZ6U/zlkVKA1L_QcJ
247
248
249Solaris Studio
250--------------
251
252Solaris Studio compilers' default standard C++ library is very
253non-standard.  It seems that it is not conforming enough in, e.g., Sun
254C++ 5.12 Linux_i386 2011/11/16 (missing `std::time_t`, etc.), but it
255works well enough on Solaris with Sun C++ 5.8 2005/10/13.  Thus
256log4cplus adds `-library=stlport4` to the `CXXFLAGS` environment
257variable, unless a switch matching `-library=(stlport4|stdcxx4|Cstd)`
258is already present there.  If you want to override the default
259supplied by log4cplus, just set it into `CXXFLAGS` on configure script
260command line.
261
262Solaris Studio supports the `__func__` symbol which can be used by
263log4cplus to record function name in logged events.  To enable this
264feature, add `-features=extensions` switch to `CXXFLAGS` for configure
265script.  Subsequently, you will have to add this switch to your
266application's build flags as well.
267
268
269Solaris Studio on GNU/Linux
270---------------------------
271
272The autotools and our configure.ac combo does not handle Solaris
273Studio compiler on Linux well enough and needs a little help with
274configuration of POSIX threads:
275
276    $ COMMON_FLAGS="-L/lib/x86_64-linux-gnu/ \
277    -L/usr/lib/x86_64-linux-gnu/ -mt=yes -O"
278
279    $ ../configure --enable-threads=yes \
280    CC=/opt/solarisstudio12.3/bin/cc \
281    CXX=/opt/solarisstudio12.3/bin/CC \
282    CFLAGS="$COMMON_FLAGS" \
283    CXXFLAGS="$COMMON_FLAGS" \
284    LDFLAGS="-lpthread"
285
286
287HP-UX with aCC
288--------------
289
290It is necessary to turn on C++98 mode of aCC by providing the `-AA` flag:
291
292    $ ../configure --enable-threds=yes CXXFLAGS="-AA"
293
294
295Haiku
296-----
297
298Haiku is supported with GCC 4+. The default GCC version in Haiku is
299set to version 2 (based on GCC 2.95.x). To change the default GCC
300version to version 4, please run `setgcc gcc4` command. This is to
301avoid linking errors like this:
302
303~~~~
304main.cpp:(.text.startup+0x54a): undefined reference to `_Unwind_Resume'
305~~~~
306
307Running the command switches the _current_ GCC version to version 4.
308This change is permanent and global. See also Haiku ticket
309[#8368](http://dev.haiku-os.org/ticket/8368).
310
311
312Qt4 / Win32 / MSVC
313------------------
314
315In order to use log4cplus in Qt4 programs it is necessary to set
316following option: `Treat WChar_t As Built in Type: No (/Zc:wchar_t-)`
317
318Set this option for log4cplus project and `Qt4DebugAppender` project
319in MS Visual Studio.  Remember to use Unicode versions of log4cplus
320libraries with Qt.  It is also necessary to make clear distinction
321between debug and release builds of Qt project and log4cplus.  Do not
322use log4cplus release library with debug version of Qt program or vice
323versa.
324
325For registering Qt4DebugAppender library at runtime, call this
326function: `log4cplus::Qt4DebugAppender::registerAppender()`
327
328Add these lines to qmake project file for using log4cplus and
329`Qt4DebugAppender`:
330
331    INCLUDEPATH += C:\log4cplus\include
332    win32 {
333        CONFIG(debug, debug|release) {
334            LIBS += -LC:\log4cplus\msvc10\Win32\bin.Debug_Unicode -llog4cplusUD
335            LIBS += -LC:\log4cplus\msvc10\Win32\bin.Debug_Unicode -llog4cplus-Qt4DebugAppender
336        } else {
337            LIBS += -LC:\log4cplus\msvc10\Win32\bin.Release_Unicode -llog4cplusU
338            LIBS += -LC:\log4cplus\msvc10\Win32\bin.Release_Unicode -llog4cplus-Qt4DebugAppender
339        }
340    }
341
342
343`LOG4CPLUS_*_FMT()` and UNICODE
344-------------------------------
345
346Beware, the `%s` specifier does not work the same way on Unix--like
347platforms as it does on Windows with Visual Studio. With Visual Studio
348the `%s` specifier changes its meaning conveniently by printing
349`wchar_t` string when used with `wprintf()` and `char` strings when
350used with `printf()`.  On the other hand, Unix--like platforms keeps
351the meaning of printing `char` strings when used with both `wprintf()`
352and `printf()`.  It is necessary to use `%ls` (C99) specifier or `%S`
353(SUSv2) specifier to print `wchar_t` strings on Unix--like platforms.
354
355The common ground for both platforms appears to be use of `%ls` and
356`wchar_t` string to print strings with unmodified formatting string
357argument on both Unix--like platforms and Windows. The conversion of
358`wchar_t` back to `char` then depends on C locale.
359
360
361C++11 support
362-------------
363
364log4cplus contains small amount of code that uses C++11 (ISO/IEC
36514882:2011 standard) language features.  C++11 features are used only
366if C++11 support is detected during compile time.  Compiling log4cplus
367with C++11 compiler and standard library and using it with C++03
368(ISO/IEC 14882:2003 standard) application is not supported.
369
370
371Unsupported compilers
372---------------------
373
374log4cplus does not support too old or broken C++ compilers:
375
376- Visual C++ prior to 7.1
377- GCC prior to 3.2
378- Older versions of Borland/CodeGear/Embarcadero C++ compilers
379
380
381Unsupported platforms
382---------------------
383
384log4cplus requires some minimal set of C and/or C++ library
385functions. Some systems/platforms fail to provide these functions and
386thus log4cplus cannot be supported there:
387
388- Windows CE - missing implementations of `<time.h>` functions
389
390
391License
392=======
393
394This library is licensed under the Apache Public License 2.0 and two
395clause BSD license.  Please read the included LICENSE file for
396details.
397