#include "../include/LogUtils.h"
#if defined(_LOG4CPP)
#include <log4cpp/PropertyConfigurator.hh>
// appenders
#include <log4cpp/Appender.hh>
#include <log4cpp/OstreamAppender.hh>
#include <log4cpp/FileAppender.hh>
#include <log4cpp/RollingFileAppender.hh>
#include <log4cpp/AbortAppender.hh>
#ifdef WIN32
#include <log4cpp/Win32DebugAppender.hh>
#include <log4cpp/NTEventLogAppender.hh>
#endif
#include <log4cpp/RemoteSyslogAppender.hh>
#ifdef LOG4CPP_HAVE_LIBIDSA
#include <log4cpp/IdsaAppender.hh>
#endif // LOG4CPP_HAVE_LIBIDSA
#ifdef LOG4CPP_HAVE_SYSLOG
#include <log4cpp/SyslogAppender.hh>
#endif
// layouts
#include <log4cpp/Layout.hh>
#include <log4cpp/BasicLayout.hh>
#include <log4cpp/SimpleLayout.hh>
#include <log4cpp/PatternLayout.hh>
#include <log4cpp/Priority.hh>
#endif
namespace logns
{
void InitializeLog4cpp(const std::string & logfile)
{
#if defined(_LOG4CPP)
try
{
log4cpp::PropertyConfigurator::configure(logfile);
}
catch (log4cpp::ConfigureFailure & f)
{
std::cerr << "Configure Problem " << f.what() << std::endl;
//#if defined(WIN32)
// log4cpp::Appender * appender = new log4cpp::Win32DebugAppender("console");
//#else
log4cpp::Appender * appender = new log4cpp::OstreamAppender("console", &std::cout);
//#endif
log4cpp::PatternLayout * patternLayout = new log4cpp::PatternLayout();
patternLayout->setConversionPattern("%d [%t] %p - %m%n");
appender->setLayout(patternLayout);
log4cpp::Category & root = log4cpp::Category::getRoot();
root.addAppender(appender);
root.setPriority(log4cpp::Priority::DEBUG);
}
#endif
}
void ReleaseLog4cpp()
{
#if defined(_LOG4CPP)
log4cpp::Category::shutdown();
#endif
}
#if defined(_LOG4CPP)
log4cpp::Category & GetLogCategory(const char * categoryName)
{
std::string name = "dk.";
name.append(categoryName);
return log4cpp::Category::getInstance(name);
}
#endif
void suck(const char * fmt, ...)
{
if (fmt) {}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Log4cpp.tar.gz (72个子文件)
20131213_MDN
Code
Trunk
ADS
ADS_RSAgent
LogUtils.cpp 2KB
RSLog.h 1011B
include
LogUtils.h 2KB
LogTracer.h 3KB
log4cpp
PassThroughLayout.hh 360B
Win32DebugAppender.hh 1KB
AbortAppender.hh 1KB
Category.hh 22KB
LayoutsFactory.hh 999B
LevelEvaluator.hh 534B
SmtpAppender.hh 871B
config-win32-stlport-boost.h 3KB
config-win32.h 4KB
Export.hh 570B
LayoutAppender.hh 1KB
threading
Threading.hh 827B
DummyThreads.hh 2KB
PThreads.hh 3KB
Makefile.am 187B
MSThreads.hh 5KB
Makefile.in 14KB
BoostThreads.hh 1KB
.svn
prop-base
props
tmp
prop-base
props
text-base
text-base
Makefile.am.svn-base 187B
Threading.hh.svn-base 827B
DummyThreads.hh.svn-base 2KB
BoostThreads.hh.svn-base 1KB
Makefile.in.svn-base 14KB
MSThreads.hh.svn-base 5KB
PThreads.hh.svn-base 3KB
OmniThreads.hh.svn-base 5KB
entries 1KB
OmniThreads.hh 5KB
config-MinGW32.h 2KB
AppenderSkeleton.hh 3KB
RemoteSyslogAppender.hh 4KB
Portability.hh 1KB
SimpleConfigurator.hh 2KB
FileAppender.hh 3KB
OstreamAppender.hh 935B
convenience.h 3KB
NTEventLogAppender.hh 3KB
StringQueueAppender.hh 2KB
PatternLayout.hh 4KB
NDC.hh 6KB
AppendersFactory.hh 1012B
SimpleLayout.hh 842B
Priority.hh 3KB
config-openvms.h 2KB
Makefile.am 1KB
BasicLayout.hh 852B
Manipulator.hh 691B
FactoryParams.hh 5KB
Makefile.in 21KB
Filter.hh 4KB
TriggeringEventEvaluator.hh 396B
BasicConfigurator.hh 693B
Appender.hh 4KB
CategoryStream.hh 4KB
Layout.hh 978B
LoggingEvent.hh 2KB
Configurator.hh 709B
IdsaAppender.hh 2KB
BufferingAppender.hh 1KB
RollingFileAppender.hh 1KB
HierarchyMaintainer.hh 2KB
FixedContextCategory.hh 6KB
SyslogAppender.hh 2KB
PropertyConfigurator.hh 2KB
TimeStamp.hh 2KB
TriggeringEventEvaluatorFactory.hh 1KB
Commlib
liblog4cpp.so.5 690KB
liblog4cpp.so 690KB
共 72 条
- 1
资源评论
- jacksonwangtao2018-11-13可以使用的
- sieyuanzpu2018-01-22如果能加入日志文件的翻滚就更完美了
yi顽童
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功