source: pacpusframework/branches/0.1.x/3rd/apache-log4cxx/include/log4cxx/rollingfileappender.h@ 257

Last change on this file since 257 was 89, checked in by morasjul, 12 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 4.4 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef _LOG4CXX_ROLLING_FILE_APPENDER_H
18#define _LOG4CXX_ROLLING_FILE_APPENDER_H
19
20#if defined(_MSC_VER)
21#pragma warning ( push )
22#pragma warning ( disable: 4231 4251 4275 4786 )
23#endif
24
25#include <log4cxx/rolling/rollingfileappenderskeleton.h>
26
27namespace log4cxx
28{
29
30 /** RollingFileAppender extends FileAppender to backup the log files when they reach a certain size. */
31 class LOG4CXX_EXPORT RollingFileAppender : public log4cxx::rolling::RollingFileAppenderSkeleton
32 {
33 private:
34 /** The default maximum file size is 10MB. */
35 long maxFileSize;
36
37 /** There is one backup file by default. */
38 int maxBackupIndex;
39
40 public:
41 //
42 // Use custom class to use non-default name to avoid
43 // conflict with log4cxx::rolling::RollingFileAppender
44 DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS( RollingFileAppender, ClassRollingFileAppender )
45 BEGIN_LOG4CXX_CAST_MAP()
46 LOG4CXX_CAST_ENTRY( RollingFileAppender )
47 LOG4CXX_CAST_ENTRY_CHAIN( FileAppender )
48 END_LOG4CXX_CAST_MAP()
49 /** The default constructor simply calls its {@link FileAppender#FileAppender parents constructor}. */
50 RollingFileAppender();
51
52 /**
53 Instantiate a RollingFileAppender and open the file designated by
54 <code>filename</code>. The opened filename will become the ouput destination for this appender.
55
56 <p>If the <code>append</code> parameter is true, the file will be appended to. Otherwise, the file desginated by
57 <code>filename</code> will be truncated before being opened.
58 */
59 RollingFileAppender( const LayoutPtr & layout, const LogString & fileName, bool append );
60
61 /**
62 Instantiate a FileAppender and open the file designated by
63 <code>filename</code>. The opened filename will become the output destination for this appender.
64 <p>The file will be appended to.
65 */
66 RollingFileAppender( const LayoutPtr & layout, const LogString & fileName );
67
68 virtual ~RollingFileAppender();
69
70 /** Returns the value of the <b>MaxBackupIndex</b> option. */
71 int getMaxBackupIndex() const;
72
73 /** Get the maximum size that the output file is allowed to reach before being rolled over to backup files. */
74 long getMaximumFileSize() const;
75
76
77 /**
78 Set the maximum number of backup files to keep around.
79
80 <p>The <b>MaxBackupIndex</b> option determines how many backup
81 files are kept before the oldest is erased. This option takes
82 a positive integer value. If set to zero, then there will be no
83 backup files and the log file will be truncated when it reaches <code>MaxFileSize</code>.
84 */
85 void setMaxBackupIndex( int maxBackupIndex );
86
87 /**
88 Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
89
90 <p>In configuration files, the <b>MaxFileSize</b> option takes an
91 long integer in the range 0 - 2^63. You can specify the value with the suffixes "KB", "MB" or "GB" so that the integer is
92 interpreted being expressed respectively in kilobytes, megabytes
93 or gigabytes. For example, the value "10KB" will be interpreted as 10240.
94 */
95 void setMaxFileSize( const LogString & value );
96
97 void setMaximumFileSize( int value );
98
99
100 virtual void setOption( const LogString & option, const LogString & value );
101
102 /** Prepares RollingFileAppender for use. */
103 void activateOptions( log4cxx::helpers::Pool & pool );
104
105
106 }; // class RollingFileAppender
107 LOG4CXX_PTR_DEF(RollingFileAppender);
108
109 } // namespace log4cxx
110
111
112#if defined(_MSC_VER)
113#pragma warning ( pop )
114#endif
115
116#endif //_LOG4CXX_ROLLING_FILE_APPENDER_H
Note: See TracBrowser for help on using the repository browser.