admin管理员组

文章数量:1666145

安装过程

下载地址:https://sourceforge/projects/log4cpp/files/latest/download

解压:tar zxf

cd log4cpp

./configure --with-pthreads

make

make check

sudo make install

sudo ldconfig

默认安装路劲:

头文件: /usr/local/include/log4cpp

 库文件:/usr/local/lib

 测试规范:

手动使用log4cpp的基础步骤:

        1.实例化一个layout对象

        2.初始化一个appender对象

        3.把layout对象附在appender对象上

        4.调用log4cpp::Category::getInstance("name"). 实例化一个category对象;

        5.把appender对象附到category上(根据additivity的值取代appender或者附加在其他appender后)

        6.设置category的优先级

编译:g++ -o 2-test_log4cpp 2-test_log4cpp.cpp -llog4cpp

本文标签: Ubuntulog4cpp