Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with upstream version 2017-07-13 08:48 #12

Merged
merged 35 commits into from
Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d2afa2e
Bumped version to 2.9.0
meyerj Dec 17, 2015
b6f144f
log4cpp: renamed library and pkg-config file to orocos-log4cpp and se…
meyerj Dec 18, 2015
f35232d
Merge remote-tracking branch 'meyerj/fix/remote-syslog-appender' into…
meyerj Dec 21, 2015
08f308a
Merge remote-tracking branch 'meyerj/renamed-to-orocos-log4cpp' into …
meyerj Dec 21, 2015
41314bd
Merge remote-tracking branch 'meyerj/master-merged-with-upstream' int…
meyerj Dec 21, 2015
49d35af
cmake: Add INSTALL_NAME_DIR to library to fix OS X 10.11 dynamic path…
Feb 15, 2016
f416754
PropertyConfiguratorImpl: add target property to allow printing to ST…
Apr 4, 2016
f6d57db
Merge pull request #5 from snrkiwi/rdt-support-osx1011
meyerj Apr 26, 2016
25cdf18
Merge remote-tracking branch 'origin/master' into toolchain-2.9
meyerj Apr 26, 2016
e036c02
Add configuration targets into tests for ConsoleAppender
Apr 27, 2016
1871fa7
mem leak solution for all appenders
Jan 4, 2016
4aaf870
config fixes; rem commented line
Apr 29, 2016
1538197
Merge branch 'bug-139-mem-leaks-alltogether' of ssh://git.code.sf.net…
Apr 29, 2016
d5b7452
bug-140: removed std::cout when file rollover
Aug 2, 2016
1302186
bug-142: conservative fix
Aug 2, 2016
c209a97
bug-141: conservative fix
Aug 2, 2016
18b189e
Merge branch 'master' into toolchain-2.9
meyerj Aug 11, 2016
544f6a2
Fix for reported patch-45, plus tests and minors
Oct 16, 2016
79c3124
src/PThreads.cpp
Oct 18, 2016
81786dd
small rename
Oct 18, 2016
c7d21d8
LOG4CPP_EXPORT
Oct 18, 2016
14babda
fix for bugs-143
Oct 21, 2016
fe4ed07
Add missing config.h/Portability.hh include
Oct 21, 2016
626e36a
bug-145: fix daily rolling; add manual test to see rolling
Nov 6, 2016
e245faf
ChangeLog
Nov 6, 2016
2053240
daily test support for windows
Nov 9, 2016
d239bf9
test daily rolling: disable test which changes dates
Nov 6, 2016
9492379
cmake: Correctly set RPATH accounting for OS X and CMake versions
Jan 8, 2017
cad9150
doc update
Apr 18, 2017
e41198f
Merge pull request #7 from snrkiwi/fix-rpath
meyerj Apr 28, 2017
4b6dd21
fix for bug 146 by Ryan Schmidt
Jun 3, 2017
1b9f8f7
fix for bug 147 - Being prepared for Removing Deprecated Exception Sp…
Jun 3, 2017
2e117d8
ChangeLog
Jul 13, 2017
1f6915e
Merge remote-tracking branch 'origin/master' into toolchain-2.9
meyerj Oct 26, 2017
4bff3f8
Merge remote-tracking branch 'upstream/master' into master-merged-wit…
meyerj Oct 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ ELSE (WIN32)
ENDIF (APPLE)
ENDIF (WIN32)

#IF ( CMAKE_BUILD_TYPE MATCHES "Debug" )
# SET ( LOG4CPP_LIBRARY_NAME "log4cppD" )
#ELSE ( CMAKE_BUILD_TYPE MATCHES "Debug" )
SET ( LOG4CPP_LIBRARY_NAME "log4cpp" )
#ENDIF ( CMAKE_BUILD_TYPE MATCHES "Debug" )
SET ( LOG4CPP_LIBRARY_NAME "orocos-log4cpp" )

ADD_LIBRARY ( ${LOG4CPP_LIBRARY_NAME} SHARED
src/Appender.cpp
Expand Down Expand Up @@ -92,12 +88,28 @@ IF (WIN32)
# SET_TARGET_PROPERTIES(${LOG4CPP_LIBRARY_NAME} PROPERTIES LINK_FLAGS /NODEFAULTLIB:msvcrt)
ENDIF (WIN32)

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

# Ensure that the full path+lib name is used in dynamic library dependencies
# in dependent libraries/executables. Without this, CMake drops the path and
# the dependency becomes just the lib name (which requires working DYLD_xxx)
SET_TARGET_PROPERTIES(${LOG4CPP_LIBRARY_NAME} PROPERTIES
INSTALL_RPATH_USE_LINK_PATH ON)
# Set INSTALL_NAME_DIR for MacOS X to tell users of this library how to find it:
if(APPLE)
if (CMAKE_VERSION VERSION_LESS "3.0.0")
SET_TARGET_PROPERTIES( ${LOG4CPP_LIBRARY_NAME} PROPERTIES
INSTALL_NAME_DIR "@rpath"
)
else()
# cope with CMake 3.x
SET_TARGET_PROPERTIES( ${LOG4CPP_LIBRARY_NAME} PROPERTIES
MACOSX_RPATH ON)
endif()
endif()

ADD_DEFINITIONS(${LOG4CPP_CFLAGS})

###########################################################
Expand All @@ -120,18 +132,18 @@ SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(exec_prefix "\${prefix}")
SET(log4cpp_cflags "")
SET(log4cpp_libs "${LOG4CPP_LIBS}")
SET(includedir "\${prefix}/include")
SET(includedir "\${prefix}/include/orocos")
SET(libdir "\${prefix}/lib")
CONFIGURE_FILE(log4cpp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/log4cpp.pc @ONLY)
CONFIGURE_FILE(log4cpp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/orocos-log4cpp.pc @ONLY)

INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/log4cpp.pc
FILES ${CMAKE_CURRENT_BINARY_DIR}/orocos-log4cpp.pc
DESTINATION lib/pkgconfig
)

INSTALL (
DIRECTORY include/log4cpp
DESTINATION include
DESTINATION include/orocos
PATTERN "config.h.in" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN "*.am" EXCLUDE
Expand All @@ -141,7 +153,7 @@ INSTALL (

INSTALL (
FILES ${CMAKE_CURRENT_BINARY_DIR}/include/log4cpp/config.h
DESTINATION include/log4cpp
DESTINATION include/orocos/log4cpp
)

INSTALL(TARGETS ${LOG4CPP_LIBRARY_NAME}
Expand Down
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2017-07-13 08:48 sanchouss_
* bug 146;
* bug 147 - Being prepared for Removing Deprecated Exception Specifications from C++17
2016-11-11 18:48 sanchouss_

* Numerous fixes;
* Added .target property for the ConsoleAppender to allow printing to STDERR
* Added method Category::shutdownForced(). It releases more memory than shutdown() by deleting all appenders.
Category::shutdownForced() may be invoked several times, not only at the end of program.

2015-03-28 18:48 sanchouss_

* Added DailyRollingFileAppender.cpp
Expand Down
27 changes: 20 additions & 7 deletions doc/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h5>How to use</h5>
</ul>
<h5>Development</h5>
<ul>
<li><a title="CVS Repository" href="#cvs">CVS
<li><a title="Git Repository" href="#git">Git
Repository</a> </li>
<li><a title="Releases" href="#releases">Releases</a>
</li>
Expand Down Expand Up @@ -561,14 +561,18 @@ <h2><a id="propfile">Properties file example</a></h2>
</div>

<div class="chapter">
<h2><a id="cvs">CVS Repository</a></h2>
<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.
CVS currently has two branches:
<h2><a id="git">Git Repository</a></h2>
<p>
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.
</p>
<p></p><table>
<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>
<small>
CVS had two branches:
<table>
<tbody><tr><td>MAIN</td><td>for log4cpp development</td></tr>
<tr><td>BRANCH_MAINT_0_2</td><td>for maintainance of log4cpp-stable (0.2.x)</td></tr>
</tbody></table><br>
</small>
Each release will receive a tag named REL_x_y_z.
<p></p>
<p>To start working with a freshly checked out log4cpp revision, run <b>./autogen.sh</b>
Expand All @@ -584,6 +588,14 @@ <h2><a id="releases">Releases</a></h2>
WARNING: releases from the development branch are a 'work in progress' and may fail to build, crash or redecorate your desktop.
</p>
<small>

<dl>
<dt>1.1.2 - master branch (18 April 2017)</dt>
<dd>Fixed memory leak after Category::shutdown() called: method Category::shutdownForced() releases memory allocated for appenders.</dd>
<dd>PropertyConfiguratorImpl: add target property to allow printing to STDERR.</dd>
<dd>Some fixes.</dd>
</dl>

<dl>
<dt>1.1.2rc1 - master branch (04 April 2015)</dt>
<dd>Small fixes, DailyRollingFile appender, tests, options to disable support for smtp and syslog</dd>
Expand Down Expand Up @@ -711,7 +723,7 @@ <h2><a id="releases">Releases</a></h2>

<div class="chapter">
<h2><a id="status">Status</a></h2>
<p>The latest stable release is 1.1.1</p>
<p>The latest stable release is 1.1.2</p>
<small>
<p>log4cpp is moved to git since version 1.1.1, cvs is stale since then</p>
<p>As of version 0.3.0 log4cpp has a separate 'stable' and 'development' branches.
Expand Down Expand Up @@ -783,4 +795,5 @@ <h2><a id="id">Chapter</a></h2>
</div>
</div>
</div>
</body></html>
</body></html>

27 changes: 23 additions & 4 deletions include/log4cpp/Appender.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <string>
#include <map>
#include <set>
#include <vector>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
Expand All @@ -31,6 +32,7 @@ namespace log4cpp {
* statements.
**/
class LOG4CPP_EXPORT Appender {
friend class Category;
public:

/**
Expand Down Expand Up @@ -130,21 +132,38 @@ namespace log4cpp {
**/
virtual Filter* getFilter() = 0;

private:
private:
typedef std::map<std::string, Appender*> AppenderMap;

static AppenderMap* _allAppenders;
static threading::Mutex _appenderMapMutex;

static AppenderMap& _getAllAppenders();
static void _deleteAllAppenders();
static void _deleteAllAppendersWOLock(std::vector<Appender*> &appenders);
static void _addAppender(Appender* appender);
static void _removeAppender(Appender* appender);

const std::string _name;

public:
class AppenderMapStorage {
public:
Appender::AppenderMap* _allAppenders; // single shared instance, nifty-counter defensed
threading::Mutex _appenderMapMutex; // mutex protecting map from multiple thread access

AppenderMapStorage();
~AppenderMapStorage();
};
class LOG4CPP_EXPORT AppenderMapStorageInitializer {
public:
AppenderMapStorageInitializer();
~AppenderMapStorageInitializer();
};
private:
static AppenderMapStorage &_appenderMapStorageInstance;
};

static Appender::AppenderMapStorageInitializer appenderMapStorageInitializer; // static initializer for every translation unit
typedef std::set<Appender *> AppenderSet;

}

#endif // _LOG4CPP_APPENDER_HH
12 changes: 8 additions & 4 deletions include/log4cpp/Category.hh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ namespace log4cpp {
static void shutdown();

/**
* This method will remove all Appenders from Categories.XXX and delete all appenders.
* Releases more memory than shutdown() by deleting appenders.
**/
static void shutdownForced();

/**
* Destructor for Category.
**/
virtual ~Category();
Expand All @@ -112,8 +118,7 @@ namespace log4cpp {
* @exception std::invalid_argument if the caller tries to set
* Priority::NOTSET on the Root Category.
**/
virtual void setPriority(Priority::Value priority)
throw(std::invalid_argument);
virtual void setPriority(Priority::Value priority);

/**
* Returns the assigned Priority, if any, for this Category.
Expand Down Expand Up @@ -146,8 +151,7 @@ namespace log4cpp {
* @param appender The Appender to wich this category has to log.
* @exception std::invalid_argument if the appender is NULL.
**/
virtual void addAppender(Appender* appender)
throw(std::invalid_argument);
virtual void addAppender(Appender* appender);

/**
* Adds an Appender for this Category.
Expand Down
3 changes: 1 addition & 2 deletions include/log4cpp/PatternLayout.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ namespace log4cpp {
* @param conversionPattern the conversion pattern
* @exception ConfigureFailure if the pattern is invalid
**/
virtual void setConversionPattern(const std::string& conversionPattern)
throw(ConfigureFailure);
virtual void setConversionPattern(const std::string& conversionPattern);

virtual std::string getConversionPattern() const;

Expand Down
16 changes: 16 additions & 0 deletions include/log4cpp/Portability.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
# else
# include <log4cpp/config-win32.h>
# endif

#ifdef MSVC_MEMORY_LEAK_CHECK
#define _CRTDBG_MAP_ALLOC

#include <stdlib.h>
#include <crtdbg.h>

#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif // _DEBUG
#endif // MSVC_MEMORY_LEAK_CHECK

#else
#if defined(__OPENVMS__)
# include <log4cpp/config-openvms.h>
Expand Down Expand Up @@ -50,4 +65,5 @@
# endif // LOG4CPP_HAVE_SSTREAM
#endif // _APPLE_


#endif
3 changes: 1 addition & 2 deletions include/log4cpp/Priority.hh
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ namespace log4cpp {
* @throw std::invalid_argument if the priorityName does not
* correspond with a known Priority name or a number
**/
static Value getPriorityValue(const std::string& priorityName)
throw(std::invalid_argument);
static Value getPriorityValue(const std::string& priorityName);
};
}

Expand Down
8 changes: 7 additions & 1 deletion include/log4cpp/PropertyConfigurator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ namespace log4cpp {
**/
class LOG4CPP_EXPORT PropertyConfigurator {
public:
static void configure(const std::string& initFileName) throw (ConfigureFailure);
/**
*
* @param initFileName
* @exception ConfigureFailure if the method encountered a read or
* syntax error.
*/
static void configure(const std::string& initFileName);
};
}

Expand Down
5 changes: 3 additions & 2 deletions include/log4cpp/SimpleConfigurator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace log4cpp {
* @exception ConfigureFailure if the method encountered a read or
* syntax error.
**/
static void configure(const std::string& initFileName) throw (ConfigureFailure);
static void configure(const std::string& initFileName);

/**
* Configure log4cpp with the configuration in the given file.
Expand All @@ -45,7 +45,8 @@ namespace log4cpp {
* @exception ConfigureFailure if the method encountered a read or
* syntax error.
**/
static void configure(std::istream& initFile) throw (ConfigureFailure); };
static void configure(std::istream& initFile);
};
}

#endif
2 changes: 1 addition & 1 deletion log4cpp.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ includedir=@includedir@
Name: @PACKAGE@
Description: C++ library for flexible logging, modeled after Log4j
Version: @VERSION@
Libs: -L${libdir} -llog4cpp
Libs: -L${libdir} -l@LOG4CPP_LIBRARY_NAME@
Cflags: -I${includedir} @log4cpp_cflags@
Libs.private: @log4cpp_libs@
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<package>
<name>log4cpp</name>
<version>2.8.3</version>
<version>2.9.0</version>
<description >
Log4cpp maintained by Orocos developers
This version of log4cpp deviates from the official release
Expand Down
Loading