1 #include "logging/RollingFileAppender.hpp" 3 #include <rtt/Logger.hpp> 5 #include <log4cpp/RollingFileAppender.hh> 12 RollingFileAppender::RollingFileAppender(std::string name) :
13 OCL::logging::Appender(name),
14 filename_prop(
"Filename",
"Name of file to log to"),
15 maxFileSize_prop(
"MaxFileSize",
16 "Maximum file size (in bytes) before rolling over",
18 maxBackupIndex_prop(
"MaxBackupIndex",
19 "Maximum number of backup files to keep",
21 maxEventsPerCycle_prop(
"MaxEventsPerCycle",
22 "Maximum number of log events to pop per cycle",
26 properties()->addProperty(filename_prop);
27 properties()->addProperty(maxEventsPerCycle_prop);
28 properties()->addProperty(maxFileSize_prop);
29 properties()->addProperty(maxBackupIndex_prop);
32 RollingFileAppender::~RollingFileAppender()
36 bool RollingFileAppender::configureHook()
39 int m = maxEventsPerCycle_prop.rvalue();
42 log(Error) <<
"Invalid maxEventsPerCycle value of " 43 << m <<
". Value must be >= 0." 47 maxEventsPerCycle = m;
51 log(Info) <<
"maxfilesize " << maxFileSize_prop.get()
52 <<
" maxbackupindex " << maxBackupIndex_prop.get() << std::endl;
53 appender =
new log4cpp::RollingFileAppender(getName(),
55 maxFileSize_prop.get(),
56 maxBackupIndex_prop.get());
58 return configureLayout();
61 void RollingFileAppender::updateHook()
63 processEvents(maxEventsPerCycle);
66 void RollingFileAppender::cleanupHook()
This file contains the macros and definitions to create dynamically loadable components.
The Orocos Component Library.