Hi,
I found out that when calling 'removeAppender', log4cpp internally checks whether the category owns the appender. When does a category own an appender?
For example: if I create one appender object
log4cpp::RollingFileAppender* appender = new ....
and add this appender to many categories
category1.setAppender(appender);
category2.setAppender(appender);
category2.setAppender(appender);
.
.
.
which category actually owns the appender?
Furthermore, when calling 'removeAppender', and the category actually owns the appender, the appender object is actually deleted. What happens if I want to log using a different category which was assigned the same appender?
I know it is a bit too much to ask at once, but I am (extensively ) using log4cpp for logging in a (very) big project and now I am stuck because I am getting Segmentation faults whenever I call 'removeAppender'.
Can anyone help?
I am using version 0.3.1 by the way (because I need the RollingFileAppender).
Thanx already ('in advance', that is).
lloyd
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-04-19
The Category class has the following 2 methods to add an appender to a category
addAppender (Appender *) and
addAppender(Appender &)
Which you use the first you pass ownership to the category, if you use the second this will not happen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I found out that when calling 'removeAppender', log4cpp internally checks whether the category owns the appender. When does a category own an appender?
For example: if I create one appender object
log4cpp::RollingFileAppender* appender = new ....
and add this appender to many categories
category1.setAppender(appender);
category2.setAppender(appender);
category2.setAppender(appender);
.
.
.
which category actually owns the appender?
Furthermore, when calling 'removeAppender', and the category actually owns the appender, the appender object is actually deleted. What happens if I want to log using a different category which was assigned the same appender?
I know it is a bit too much to ask at once, but I am (extensively ) using log4cpp for logging in a (very) big project and now I am stuck because I am getting Segmentation faults whenever I call 'removeAppender'.
Can anyone help?
I am using version 0.3.1 by the way (because I need the RollingFileAppender).
Thanx already ('in advance', that is).
lloyd
The Category class has the following 2 methods to add an appender to a category
addAppender (Appender *) and
addAppender(Appender &)
Which you use the first you pass ownership to the category, if you use the second this will not happen