#29 Support real-time systems

Stephen Roderick

We are looking for a log4j-style, C++ logging package to use in soft- and hard-realtime robotic systems. I was wondering if anyone has previously considered using log4cpp in realtime systems?

Obviously, appenders that write to disc, etc, would be in non-real-time parts of the system, but the ability to log from real-time tasks would be extremely useful. The real killer here is dynamic memory allocation, which log4cpp uses liberally. Without a O(c) allocator (few operating systems provide this), it is unuseable in real-time. Reviewing the code, it would require significant modifications to support real-time, however, this appears to be much more doable than with log4cxx, etc, due to a decent class design (and far less dependancies than APR!).

I was just wondering if it had ever been considered?



  • Thomas Wabner
    Thomas Wabner

    I don't know about any discussion related to realtime systems. But if you interested in changing log4cpp to have such real-time support you can simple join our development team. I can give you developer rights and support related to the toolchain and maintainance.

    Of corse you may also put your question in our developer and user maillinglist.

  • Thanks for the possible developer rights. I might take you up on that.

    The overall picture is that I'm looking at using log4cpp as the basis for a real-time logging system for the Orocos project: http://www.orocos.org/. If you are interested, message list traffic is at http://www.orocos.org/forum/rtt/rtt-dev/logging-replacement while a wiki page with more details is at http://www.orocos.org/wiki/rtt/rtt-20/real-time-logging

    We're still looking at the overall changes that are required on both the log4cpp and Orocos end of things, but so far the changes for log4cpp look like
    - being able to build log4cpp with std::string, or with real-time support
    - using a project-wide string type, which we can override to use a real-time allocatable string instead of std::string when building log4cpp with real-time support (this may only need to be in LoggingEvent, I'm not sure yet)
    - modifying the HierarchyMaintainer implementation to allow creation of objects derived from log4cpp::Category. Maybe just a factory here, not sure yet. Our derived Category class needs additional objects and information.

    I would definitely be looking for some suggestions from you, of how you would like these changes to be made. The second one, in particular, is pretty intrusive.