#include#include #include int main() { log4cplus::initialize(); log4cplus::BasicConfigurator config; config.configure(); log4cplus::Logger logger = log4cplus::Logger::getInstance("main"); LOG4CPLUS_DEBUG(logger, "This is a debug message"); LOG4CPLUS_INFO(logger, "This is an info message"); LOG4CPLUS_WARN(logger, "This is a warning message"); LOG4CPLUS_ERROR(logger, "This is an error message"); return 0; }
#includeIn this example, the Boost.Log package library is used to log messages of different severity levels. The logs are output to the console by default, but it can be configured to use other output formats such as file or Syslog.#include int main() { BOOST_LOG_TRIVIAL(trace) << "This is a trace message"; BOOST_LOG_TRIVIAL(debug) << "This is a debug message"; BOOST_LOG_TRIVIAL(info) << "This is an info message"; BOOST_LOG_TRIVIAL(warning) << "This is a warning message"; BOOST_LOG_TRIVIAL(error) << "This is an error message"; BOOST_LOG_TRIVIAL(fatal) << "This is a fatal message"; return 0; }