Get the logger in Log4Qt

Author: Yiqu, Ersanli
Personal Wechat ID: iwaleon
Wechat Official Account: Efficient Programmer

In Log4Qt, there is a very important class - Logger, which is used to provide log service. So, how to get the logger?

About this part, there is a simple description in Log4Qt :

Request a logger by either calling Log4Qt::Logger::logger or using LOG4QT_DECLARE_QCLASS_LOGGER

In fact, in addition to these two ways, there is another way LOG4QT_DECLARE_STATIC_LOGGERto choose from.

transferLog4Qt::Logger::logger

Through the basic configuration and rootLogger, complete a simple use of Log4Qt:

#include <QCoreApplication>
#include <log4qt/basicconfigurator.h>
#include <log4qt/logger.h>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    // 一个简单的基础配置
    Log4Qt::BasicConfigurator::conf

Guess you like

Origin blog.csdn.net/u011012932/article/details/78779000