00001 /* 00002 * FileAppender.hh 00003 * 00004 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2000, Bastiaan Bakker. All rights reserved. 00006 * 00007 * See the COPYING file for the terms of usage and distribution. 00008 */ 00009 00010 #ifndef _LOG4CPP_FILEAPPENDER_HH 00011 #define _LOG4CPP_FILEAPPENDER_HH 00012 00013 #include <log4cpp/Portability.hh> 00014 #include <log4cpp/LayoutAppender.hh> 00015 #include <string> 00016 #include <stdarg.h> 00017 00018 namespace log4cpp { 00019 00020 class LOG4CPP_EXPORT FileAppender : public LayoutAppender { 00021 public: 00022 00032 FileAppender(const std::string& name, const std::string& fileName, 00033 bool append = true, mode_t mode = 00644); 00034 00040 FileAppender(const std::string& name, int fd); 00041 virtual ~FileAppender(); 00042 00050 virtual bool reopen(); 00051 00055 virtual void close(); 00056 00065 virtual void setAppend(bool append); 00066 00070 virtual bool getAppend() const; 00071 00075 virtual void setMode(mode_t mode); 00076 00080 virtual mode_t getMode() const; 00081 00082 protected: 00083 virtual void _append(const LoggingEvent& event); 00084 00085 const std::string _fileName; 00086 int _fd; 00087 int _flags; 00088 mode_t _mode; 00089 }; 00090 } 00091 00092 #endif // _LOG4CPP_FILEAPPENDER_HH