log4qt

log4qt

下载: http://sourceforge.net/projects/log4qt/develop

示例
    QCoreApplication a(argc, argv);

    Log4Qt::Logger 
* logger  =  Log4Qt::Logger::rootLogger();
    Log4Qt::FileAppender 
* fileAppender  =   new  Log4Qt::FileAppender();
    fileAppender
-> setName( " Log4QtTest " );
    fileAppender
-> setFile( " 20110425.log " );
    Log4Qt::TTCCLayout 
* layout  =   new  Log4Qt::TTCCLayout(Log4Qt::TTCCLayout::ISO8601);
    fileAppender
-> setLayout(layout);
    fileAppender
-> activateOptions();
    logger
-> addAppender(fileAppender);

    logger
-> error( " error message: %1, %2 " , __FILE__, __LINE__);
    logger
-> debug( " debug message. " );

    
return  a.exec();

你可能感兴趣的:(log4qt)