Skip to content

Commit a920aca

Browse files
authored
Merge pull request #12 from meyerj/master-merged-with-upstream
Merge with upstream version 2017-07-13 08:48
2 parents 359be7d + 4bff3f8 commit a920aca

32 files changed

+542
-140
lines changed

CMakeLists.txt

+26-14
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ ELSE (WIN32)
3030
ENDIF (APPLE)
3131
ENDIF (WIN32)
3232

33-
#IF ( CMAKE_BUILD_TYPE MATCHES "Debug" )
34-
# SET ( LOG4CPP_LIBRARY_NAME "log4cppD" )
35-
#ELSE ( CMAKE_BUILD_TYPE MATCHES "Debug" )
36-
SET ( LOG4CPP_LIBRARY_NAME "log4cpp" )
37-
#ENDIF ( CMAKE_BUILD_TYPE MATCHES "Debug" )
33+
SET ( LOG4CPP_LIBRARY_NAME "orocos-log4cpp" )
3834

3935
ADD_LIBRARY ( ${LOG4CPP_LIBRARY_NAME} SHARED
4036
src/Appender.cpp
@@ -92,12 +88,28 @@ IF (WIN32)
9288
# SET_TARGET_PROPERTIES(${LOG4CPP_LIBRARY_NAME} PROPERTIES LINK_FLAGS /NODEFAULTLIB:msvcrt)
9389
ENDIF (WIN32)
9490

95-
# Note: this so-version is required by OCL, such that it can distinguish 'regular' log4cpp
96-
# from 'rtt' log4cpp.
97-
SET(VERSION "6.0.0")
98-
SET(SOVERSION "6.0")
91+
SET(VERSION "2.9.0")
92+
SET(SOVERSION "2.9")
9993
SET_TARGET_PROPERTIES(${LOG4CPP_LIBRARY_NAME} PROPERTIES VERSION ${VERSION} SOVERSION ${SOVERSION})
10094

95+
# Ensure that the full path+lib name is used in dynamic library dependencies
96+
# in dependent libraries/executables. Without this, CMake drops the path and
97+
# the dependency becomes just the lib name (which requires working DYLD_xxx)
98+
SET_TARGET_PROPERTIES(${LOG4CPP_LIBRARY_NAME} PROPERTIES
99+
INSTALL_RPATH_USE_LINK_PATH ON)
100+
# Set INSTALL_NAME_DIR for MacOS X to tell users of this library how to find it:
101+
if(APPLE)
102+
if (CMAKE_VERSION VERSION_LESS "3.0.0")
103+
SET_TARGET_PROPERTIES( ${LOG4CPP_LIBRARY_NAME} PROPERTIES
104+
INSTALL_NAME_DIR "@rpath"
105+
)
106+
else()
107+
# cope with CMake 3.x
108+
SET_TARGET_PROPERTIES( ${LOG4CPP_LIBRARY_NAME} PROPERTIES
109+
MACOSX_RPATH ON)
110+
endif()
111+
endif()
112+
101113
ADD_DEFINITIONS(${LOG4CPP_CFLAGS})
102114

103115
###########################################################
@@ -120,18 +132,18 @@ SET(prefix "${CMAKE_INSTALL_PREFIX}")
120132
SET(exec_prefix "\${prefix}")
121133
SET(log4cpp_cflags "")
122134
SET(log4cpp_libs "${LOG4CPP_LIBS}")
123-
SET(includedir "\${prefix}/include")
135+
SET(includedir "\${prefix}/include/orocos")
124136
SET(libdir "\${prefix}/lib")
125-
CONFIGURE_FILE(log4cpp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/log4cpp.pc @ONLY)
137+
CONFIGURE_FILE(log4cpp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/orocos-log4cpp.pc @ONLY)
126138

127139
INSTALL(
128-
FILES ${CMAKE_CURRENT_BINARY_DIR}/log4cpp.pc
140+
FILES ${CMAKE_CURRENT_BINARY_DIR}/orocos-log4cpp.pc
129141
DESTINATION lib/pkgconfig
130142
)
131143

132144
INSTALL (
133145
DIRECTORY include/log4cpp
134-
DESTINATION include
146+
DESTINATION include/orocos
135147
PATTERN "config.h.in" EXCLUDE
136148
PATTERN ".svn" EXCLUDE
137149
PATTERN "*.am" EXCLUDE
@@ -141,7 +153,7 @@ INSTALL (
141153

142154
INSTALL (
143155
FILES ${CMAKE_CURRENT_BINARY_DIR}/include/log4cpp/config.h
144-
DESTINATION include/log4cpp
156+
DESTINATION include/orocos/log4cpp
145157
)
146158

147159
INSTALL(TARGETS ${LOG4CPP_LIBRARY_NAME}

ChangeLog

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2017-07-13 08:48 sanchouss_
2+
* bug 146;
3+
* bug 147 - Being prepared for Removing Deprecated Exception Specifications from C++17
4+
2016-11-11 18:48 sanchouss_
5+
6+
* Numerous fixes;
7+
* Added .target property for the ConsoleAppender to allow printing to STDERR
8+
* Added method Category::shutdownForced(). It releases more memory than shutdown() by deleting all appenders.
9+
Category::shutdownForced() may be invoked several times, not only at the end of program.
10+
111
2015-03-28 18:48 sanchouss_
212

313
* Added DailyRollingFileAppender.cpp

doc/html/index.html

+20-7
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h5>How to use</h5>
4545
</ul>
4646
<h5>Development</h5>
4747
<ul>
48-
<li><a title="CVS Repository" href="#cvs">CVS
48+
<li><a title="Git Repository" href="#git">Git
4949
Repository</a> </li>
5050
<li><a title="Releases" href="#releases">Releases</a>
5151
</li>
@@ -561,14 +561,18 @@ <h2><a id="propfile">Properties file example</a></h2>
561561
</div>
562562

563563
<div class="chapter">
564-
<h2><a id="cvs">CVS Repository</a></h2>
565-
<p>Log4cpp is also available directly through CVS, see the <a href="http://sourceforge.net/cvs/?group_id=15190">SourceForge CVS page</a> for instructions.
566-
CVS currently has two branches:
564+
<h2><a id="git">Git Repository</a></h2>
565+
<p>
566+
log4cpp is moved to git <a href="https://sourceforge.net/p/log4cpp/codegit/">SourceForge Git page</a> since version 1.1.1, cvs is stale now.
567567
</p>
568-
<p></p><table>
568+
<p>Log4cpp of older versions is also available through CVS, see the <a href="https://sourceforge.net/p/log4cpp/code/">SourceForge CVS page</a> for instructions.</p>
569+
<small>
570+
CVS had two branches:
571+
<table>
569572
<tbody><tr><td>MAIN</td><td>for log4cpp development</td></tr>
570573
<tr><td>BRANCH_MAINT_0_2</td><td>for maintainance of log4cpp-stable (0.2.x)</td></tr>
571574
</tbody></table><br>
575+
</small>
572576
Each release will receive a tag named REL_x_y_z.
573577
<p></p>
574578
<p>To start working with a freshly checked out log4cpp revision, run <b>./autogen.sh</b>
@@ -584,6 +588,14 @@ <h2><a id="releases">Releases</a></h2>
584588
WARNING: releases from the development branch are a 'work in progress' and may fail to build, crash or redecorate your desktop.
585589
</p>
586590
<small>
591+
592+
<dl>
593+
<dt>1.1.2 - master branch (18 April 2017)</dt>
594+
<dd>Fixed memory leak after Category::shutdown() called: method Category::shutdownForced() releases memory allocated for appenders.</dd>
595+
<dd>PropertyConfiguratorImpl: add target property to allow printing to STDERR.</dd>
596+
<dd>Some fixes.</dd>
597+
</dl>
598+
587599
<dl>
588600
<dt>1.1.2rc1 - master branch (04 April 2015)</dt>
589601
<dd>Small fixes, DailyRollingFile appender, tests, options to disable support for smtp and syslog</dd>
@@ -711,7 +723,7 @@ <h2><a id="releases">Releases</a></h2>
711723

712724
<div class="chapter">
713725
<h2><a id="status">Status</a></h2>
714-
<p>The latest stable release is 1.1.1</p>
726+
<p>The latest stable release is 1.1.2</p>
715727
<small>
716728
<p>log4cpp is moved to git since version 1.1.1, cvs is stale since then</p>
717729
<p>As of version 0.3.0 log4cpp has a separate 'stable' and 'development' branches.
@@ -783,4 +795,5 @@ <h2><a id="id">Chapter</a></h2>
783795
</div>
784796
</div>
785797
</div>
786-
</body></html>
798+
</body></html>
799+

include/log4cpp/Appender.hh

+23-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <string>
1515
#include <map>
1616
#include <set>
17+
#include <vector>
1718
#include <stdarg.h>
1819
#include <sys/types.h>
1920
#include <sys/stat.h>
@@ -31,6 +32,7 @@ namespace log4cpp {
3132
* statements.
3233
**/
3334
class LOG4CPP_EXPORT Appender {
35+
friend class Category;
3436
public:
3537

3638
/**
@@ -130,21 +132,38 @@ namespace log4cpp {
130132
**/
131133
virtual Filter* getFilter() = 0;
132134

133-
private:
135+
private:
134136
typedef std::map<std::string, Appender*> AppenderMap;
135-
136-
static AppenderMap* _allAppenders;
137-
static threading::Mutex _appenderMapMutex;
138137

139138
static AppenderMap& _getAllAppenders();
140139
static void _deleteAllAppenders();
140+
static void _deleteAllAppendersWOLock(std::vector<Appender*> &appenders);
141141
static void _addAppender(Appender* appender);
142142
static void _removeAppender(Appender* appender);
143143

144144
const std::string _name;
145+
146+
public:
147+
class AppenderMapStorage {
148+
public:
149+
Appender::AppenderMap* _allAppenders; // single shared instance, nifty-counter defensed
150+
threading::Mutex _appenderMapMutex; // mutex protecting map from multiple thread access
151+
152+
AppenderMapStorage();
153+
~AppenderMapStorage();
154+
};
155+
class LOG4CPP_EXPORT AppenderMapStorageInitializer {
156+
public:
157+
AppenderMapStorageInitializer();
158+
~AppenderMapStorageInitializer();
159+
};
160+
private:
161+
static AppenderMapStorage &_appenderMapStorageInstance;
145162
};
146163

164+
static Appender::AppenderMapStorageInitializer appenderMapStorageInitializer; // static initializer for every translation unit
147165
typedef std::set<Appender *> AppenderSet;
166+
148167
}
149168

150169
#endif // _LOG4CPP_APPENDER_HH

include/log4cpp/Category.hh

+8-4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ namespace log4cpp {
9595
static void shutdown();
9696

9797
/**
98+
* This method will remove all Appenders from Categories.XXX and delete all appenders.
99+
* Releases more memory than shutdown() by deleting appenders.
100+
**/
101+
static void shutdownForced();
102+
103+
/**
98104
* Destructor for Category.
99105
**/
100106
virtual ~Category();
@@ -112,8 +118,7 @@ namespace log4cpp {
112118
* @exception std::invalid_argument if the caller tries to set
113119
* Priority::NOTSET on the Root Category.
114120
**/
115-
virtual void setPriority(Priority::Value priority)
116-
throw(std::invalid_argument);
121+
virtual void setPriority(Priority::Value priority);
117122

118123
/**
119124
* Returns the assigned Priority, if any, for this Category.
@@ -146,8 +151,7 @@ namespace log4cpp {
146151
* @param appender The Appender to wich this category has to log.
147152
* @exception std::invalid_argument if the appender is NULL.
148153
**/
149-
virtual void addAppender(Appender* appender)
150-
throw(std::invalid_argument);
154+
virtual void addAppender(Appender* appender);
151155

152156
/**
153157
* Adds an Appender for this Category.

include/log4cpp/PatternLayout.hh

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ namespace log4cpp {
8484
* @param conversionPattern the conversion pattern
8585
* @exception ConfigureFailure if the pattern is invalid
8686
**/
87-
virtual void setConversionPattern(const std::string& conversionPattern)
88-
throw(ConfigureFailure);
87+
virtual void setConversionPattern(const std::string& conversionPattern);
8988

9089
virtual std::string getConversionPattern() const;
9190

include/log4cpp/Portability.hh

+16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616
# else
1717
# include <log4cpp/config-win32.h>
1818
# endif
19+
20+
#ifdef MSVC_MEMORY_LEAK_CHECK
21+
#define _CRTDBG_MAP_ALLOC
22+
23+
#include <stdlib.h>
24+
#include <crtdbg.h>
25+
26+
#ifdef _DEBUG
27+
#ifndef DBG_NEW
28+
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
29+
#define new DBG_NEW
30+
#endif
31+
#endif // _DEBUG
32+
#endif // MSVC_MEMORY_LEAK_CHECK
33+
1934
#else
2035
#if defined(__OPENVMS__)
2136
# include <log4cpp/config-openvms.h>
@@ -50,4 +65,5 @@
5065
# endif // LOG4CPP_HAVE_SSTREAM
5166
#endif // _APPLE_
5267

68+
5369
#endif

include/log4cpp/Priority.hh

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ namespace log4cpp {
103103
* @throw std::invalid_argument if the priorityName does not
104104
* correspond with a known Priority name or a number
105105
**/
106-
static Value getPriorityValue(const std::string& priorityName)
107-
throw(std::invalid_argument);
106+
static Value getPriorityValue(const std::string& priorityName);
108107
};
109108
}
110109

include/log4cpp/PropertyConfigurator.hh

+7-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ namespace log4cpp {
4545
**/
4646
class LOG4CPP_EXPORT PropertyConfigurator {
4747
public:
48-
static void configure(const std::string& initFileName) throw (ConfigureFailure);
48+
/**
49+
*
50+
* @param initFileName
51+
* @exception ConfigureFailure if the method encountered a read or
52+
* syntax error.
53+
*/
54+
static void configure(const std::string& initFileName);
4955
};
5056
}
5157

include/log4cpp/SimpleConfigurator.hh

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace log4cpp {
3434
* @exception ConfigureFailure if the method encountered a read or
3535
* syntax error.
3636
**/
37-
static void configure(const std::string& initFileName) throw (ConfigureFailure);
37+
static void configure(const std::string& initFileName);
3838

3939
/**
4040
* Configure log4cpp with the configuration in the given file.
@@ -45,7 +45,8 @@ namespace log4cpp {
4545
* @exception ConfigureFailure if the method encountered a read or
4646
* syntax error.
4747
**/
48-
static void configure(std::istream& initFile) throw (ConfigureFailure); };
48+
static void configure(std::istream& initFile);
49+
};
4950
}
5051

5152
#endif

log4cpp.pc.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ includedir=@includedir@
66
Name: @PACKAGE@
77
Description: C++ library for flexible logging, modeled after Log4j
88
Version: @VERSION@
9-
Libs: -L${libdir} -llog4cpp
9+
Libs: -L${libdir} -l@LOG4CPP_LIBRARY_NAME@
1010
Cflags: -I${includedir} @log4cpp_cflags@
1111
Libs.private: @log4cpp_libs@

package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<package>
22
<name>log4cpp</name>
3-
<version>2.8.3</version>
3+
<version>2.9.0</version>
44
<description >
55
Log4cpp maintained by Orocos developers
66
This version of log4cpp deviates from the official release

0 commit comments

Comments
 (0)