ロゴ4 cxxを使う

2837 ワード

参考住所:http://blog.19lou.com/10143734/viewspace-157322
#include "log4cxx/logger.h"
#include
"log4cxx/basicconfigurator.h"
#include
"log4cxx/helpers/exception.h"

using namespace std;
using namespace log4cxx;
using namespace log4cxx::helpers;

int main(int argc, char* argv[])
{
LoggerPtr logger(Logger::getLogger(
"MyApp"));

try
{
BasicConfigurator::configure();
LOG4CXX_INFO(logger,
" hello");
LOG4CXX_DEBUG(logger,
"world");
}
catch (Exception&)
{

}
return 0;
}
 
コンパイル:g+-g-Wall-O 0 log.cpp-o log-llowg 4 cxx
 
終了