Categories: CategoryCpp

Logging frameworks similar to log4j.

see: * log4cpp, http://log4cpp.sourceforge.net/

runs on linux and windows, it's available as debian package liblog4cpp.

You can find a tutorial at: http://soldc.sun.com/articles/logging.html/

Other related tools are: * log4c, http://log4c.sourceforge.net/ just runs on unix/linux

Simple example:

#include 
#include 
#include 
#include 

void main()
{
   log4cpp::Appender* appender;
   log4cpp::Category& cat = log4cpp::Category::getRoot();
   appender = new log4cpp::FileAppender("default", "log.txt");
   appender->setLayout(new log4cpp::SimpleLayout());
   cat.setAppender(appender);
   cat.setPriority(log4cpp::Priority::DEBUG);

   cat.debug("here we go");
   cat.info("here comes an info");

   log4cpp::Category::shutdown();
}