Menu

Who owns appenders?

Help
2003-04-11
2003-04-19
  • Lloyd Rahimisa

    Lloyd Rahimisa - 2003-04-11

    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

     
    • Anonymous

      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

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.