From: <log...@li...> - 2015-03-16 05:57:15
|
Hello Stuart, The categories in current design are seen as purposed for kind of static matters, those which do not actively come into the processing and leave it. There is static helper method to make their creation convenient and controlled. However, there is no destroy method since the pointer given out might still be kept somewhere else, out of log4cpp internals. If you'd like to have an unique id coming along with your log messages, you could take advantage of the NDC feature. It is exactly purposed for attaching kind of context to the log messages. It can be turned on and off from properties file without rebuilding, but note that is linked with a thread, and not with the particular category. If your processing is not thread-based, won't it be easier to log the id just as a part of the message itself? Alexander. On Mar 16, 2015 3:26 AM, <log...@li...> wrote: > Hi all, > > A silly question, I'm looking to use log4cpp for a data collection > system I'm working on. > > To help in post mortem analysis it's often useful to separate out log > messages by some common key to be able to piece out what happened. The > system starts multiple transaction state machines each identified by a > unique ID, creating them at runtime. They are one-shot, so once > complete, the objects are freed. > > It appears it would make sense for each transaction state machine to > have its own log category, as the log messages can then be grepped for > and it ensures *every* log message from that log instance will have the > ID prepended. > > It seems I can create as many category objects as I like, but what isn't > clear is what happens to the category objects when they're no longer > needed: I don't see any way to close them off or destroy them. (I could > call delete(&category); but I'm not sure where else the pointer may be > used.) > > Is there a way to remove categories once they're no longer in use? > Regards, > -- > _ ___ Stuart Longland - Systems Engineer > \ /|_) | T: +61 7 3535 9619 > \/ | \ | 38b Douglas Street F: +61 7 3535 9699 > SYSTEMS Milton QLD 4064 http://www.vrt.com.au > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Log4cpp-devel mailing list > Log...@li... > https://lists.sourceforge.net/lists/listinfo/log4cpp-devel > |