{SimpleLayout}
{PatternLayout} // 当layout的值是BasicLayout时,需要定义下面的属性。
[ConversionPattern]
[rootCategory]
[additivity]
[category name] bool true
基本使用步骤是:
读取解析配置文件;
实例化category对象;
正常使用这些category对象进行日志处理;
下面是个简单的使用代码,使用起来是非常方便的:
// FileName: test_log4cpp2.cpp
// Test log4cpp by config file.
// Announce: use as your own risk.
// Compile : g++ -llog4cpp test_log4cpp2.cpp
// Run : ./a.out
// Tested: RedHat 7.2 log4cpp0.3.4b
// Author: liqun (liqun@nsfocus.com)
// Data : 2003-6-27
#include "log4cpp/Category.hh"
#include "log4cpp/PropertyConfigurator.hh"
int main(int argc, char* argv[])
{
// 1 读取解析配置文件
// 读取出错, 完全可以忽略,可以定义一个缺省策略或者使用系统缺省策略
// BasicLayout输出所有优先级日志到ConsoleAppender
try {
log4cpp::PropertyConfigurator::configure("./log4cpp.conf");
} catch(log4cpp::ConfigureFailure& f) {
std::cout
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmousewheel="return imgzoom(this);" alt="" /> screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmousewheel="return imgzoom(this);" alt="" /> screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmousewheel="return imgzoom(this);" alt="" /> screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmousewheel="return imgzoom(this);" alt="" />
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-23410-7.html
人家的确是在公海航行
北洋海军成军时
我支持