source: pacpusframework/trunk/3rd/apache-log4cxx/include/log4cxx/rolling/rollingfileappender.h@ 12

Last change on this file since 12 was 2, checked in by sgosseli, 12 years ago

Add 3rd party libraries (log4cxx).

File size: 4.0 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
18#if !defined(_LOG4CXX_ROLLING_ROLLING_FILE_APPENDER_H)
19#define _LOG4CXX_ROLLING_ROLLING_FILE_APPENDER_H
20
21#include <log4cxx/rolling/rollingfileappenderskeleton.h>
22
23
24namespace log4cxx {
25 namespace rolling {
26
27
28 /**
29 * <code>RollingFileAppender</code> extends {@link log4cxx::FileAppender} to backup the log files
30 * depending on {@link log4cxx::rolling::RollingPolicy RollingPolicy} and {@link log4cxx::rolling::TriggeringPolicy TriggeringPolicy}.
31 * <p>
32 * To be of any use, a <code>RollingFileAppender</code> instance must have both
33 * a <code>RollingPolicy</code> and a <code>TriggeringPolicy</code> set up.
34 * However, if its <code>RollingPolicy</code> also implements the
35 * <code>TriggeringPolicy</code> interface, then only the former needs to be
36 * set up. For example, {@link log4cxx::rolling::TimeBasedRollingPolicy TimeBasedRollingPolicy} acts both as a
37 * <code>RollingPolicy</code> and a <code>TriggeringPolicy</code>.
38 *
39 * <p><code>RollingFileAppender</code> can be configured programattically or
40 * using {@link log4cxx::xml::DOMConfigurator}. Here is a sample
41 * configration file:
42
43 <pre>&lt;?xml version="1.0" encoding="UTF-8" ?>
44 &lt;!DOCTYPE log4j:configuration>
45
46 &lt;log4j:configuration debug="true">
47
48 &lt;appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
49 <b>&lt;rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
50 &lt;param name="FileNamePattern" value="/wombat/foo.%d{yyyy-MM}.gz"/>
51 &lt;/rollingPolicy></b>
52
53 &lt;layout class="org.apache.log4j.PatternLayout">
54 &lt;param name="ConversionPattern" value="%c{1} - %m%n"/>
55 &lt;/layout>
56 &lt;/appender>
57
58 &lt;root">
59 &lt;appender-ref ref="ROLL"/>
60 &lt;/root>
61
62 &lt;/log4j:configuration>
63 </pre>
64
65 *<p>This configuration file specifies a monthly rollover schedule including
66 * automatic compression of the archived files. See
67 * {@link TimeBasedRollingPolicy} for more details.
68 *
69 *
70 *
71 *
72 * */
73 class LOG4CXX_EXPORT RollingFileAppender : public RollingFileAppenderSkeleton {
74 DECLARE_LOG4CXX_OBJECT(RollingFileAppender)
75 BEGIN_LOG4CXX_CAST_MAP()
76 LOG4CXX_CAST_ENTRY(RollingFileAppender)
77 LOG4CXX_CAST_ENTRY_CHAIN(RollingFileAppenderSkeleton)
78 END_LOG4CXX_CAST_MAP()
79
80 public:
81 RollingFileAppender();
82
83 using RollingFileAppenderSkeleton::getRollingPolicy;
84
85 using RollingFileAppenderSkeleton::getTriggeringPolicy;
86
87 /**
88 * Sets the rolling policy. In case the 'policy' argument also implements
89 * {@link TriggeringPolicy}, then the triggering policy for this appender
90 * is automatically set to be the policy argument.
91 * @param policy
92 */
93 using RollingFileAppenderSkeleton::setRollingPolicy;
94
95 using RollingFileAppenderSkeleton::setTriggeringPolicy;
96
97 };
98
99 LOG4CXX_PTR_DEF(RollingFileAppender);
100
101 }
102}
103
104#endif
105
Note: See TracBrowser for help on using the repository browser.