From: Bastiaan B. <Bas...@li...> - 2002-01-10 10:34:00
|
=20 -----Original Message----- From: Alex Tapaccos [mailto:ATa...@re...] Sent: Thursday, January 10, 2002 11:10 AM To: 'log...@li...' Subject: RE: [Log4cpp-devel] Daily Rolling File Appender v3 Thanks to Evert for all his useful comments=20 Event it looks like we are both right the Log4j equivalent is called DailyRollingFileAppender!=20 I have renamed the files accordingly plus added some extra time checks for each duration.=20 The config file option will now have to say=20 appender category layout dailyrolling lognameformat frequency=20 e.g.=20 appender Test.Application pattern dailyrolling %d%m%Y.log hourly %r %c %p %m%n=20 I am glad it compiles with Borland as I use VC but tried to stick within the STL.=20 Test App=20 // LogTest.cpp : Defines the entry point for the console application.=20 //=20 #include "stdafx.h"=20 #include "RFStringTable.h"=20 #include <stdio.h>=20 #include "conio.h"=20 #include "windows.h"=20 #include <iostream>=20 #include "log4cpp/Category.hh"=20 #include "log4cpp/Appender.hh"=20 #include "log4cpp/OstreamAppender.hh"=20 #include "log4cpp/Layout.hh"=20 #include "log4cpp/BasicLayout.hh"=20 #include "log4cpp/Priority.hh"=20 #include "log4cpp/NDC.hh"=20 #include "log4cpp/SimpleConfigurator.hh"=20 #include "windows.h"=20 #include "process.h"=20 #include "conio.h"=20 int main(int argc, char* argv[])=20 {=20 try=20 {=20 log4cpp::SimpleConfigurator::configure("your config file");=20 log4cpp::Category& sub1=3D=20 log4cpp::Category::getInstance(std::string("Test.Application")); sub1.error("FOO");=20 =20 while (1) // This loop will allow to keep add messages while changing your clock for testing=20 {=20 if (_kbhit())=20 {=20 char t=3Dgetch();=20 if (t=3D=3D'q') break; =20 sub1.error("BAR");=20 t=3D0;=20 }=20 }=20 }=20 catch (log4cpp::ConfigureFailure& e)=20 {=20 printf(e.what());=20 }=20 log4cpp::Category::shutdown();=20 return 0;=20 }=20 |