Coverage Report

Created: 2025-10-10 06:53

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/logging-log4cxx/src/main/include/log4cxx/rolling/rollingpolicy.h
Line
Count
Source
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_POLICY_H)
19
#define _LOG4CXX_ROLLING_ROLLING_POLICY_H
20
21
#include <log4cxx/spi/optionhandler.h>
22
#include <log4cxx/rolling/rolloverdescription.h>
23
#include <log4cxx/file.h>
24
25
namespace LOG4CXX_NS
26
{
27
namespace rolling
28
{
29
30
31
/**
32
 * A <code>RollingPolicy</code> is responsible for performing the
33
 * rolling over of the active log file. The <code>RollingPolicy</code>
34
 * is also responsible for providing the <em>active log file</em>,
35
 * that is the live file where logging output will be directed.
36
 *
37
 *
38
 *
39
 *
40
*/
41
class LOG4CXX_EXPORT RollingPolicy :
42
  public virtual spi::OptionHandler
43
{
44
    DECLARE_ABSTRACT_LOG4CXX_OBJECT(RollingPolicy)
45
46
  public:
47
1.46k
    virtual ~RollingPolicy() {}
48
49
    /**
50
     * Initialize the policy and return any initial actions for rolling file appender.
51
     *
52
     * @param currentActiveFile current value of RollingFileAppender.getFile().
53
     * @param append current value of RollingFileAppender.getAppend().
54
     * @param pool pool for memory allocations during call.
55
     * @return Description of the initialization, may be null to indicate
56
     * no initialization needed.
57
     * @throws SecurityException if denied access to log files.
58
     */
59
    virtual RolloverDescriptionPtr initialize(
60
      const   LogString&              currentActiveFile,
61
      const   bool                    append,
62
      LOG4CXX_NS::helpers::Pool& pool) = 0;
63
64
    /**
65
     * Prepare for a rollover.  This method is called prior to
66
     * closing the active log file, performs any necessary
67
     * preliminary actions and describes actions needed
68
     * after close of current log file.
69
     *
70
     * @param currentActiveFile file name for current active log file.
71
     * @param append current value of the parent FileAppender.getAppend().
72
     * @param pool pool for memory allocations during call.
73
     * @return Description of pending rollover, may be null to indicate no rollover
74
     * at this time.
75
     * @throws SecurityException if denied access to log files.
76
     */
77
    virtual RolloverDescriptionPtr rollover(
78
      const   LogString&              currentActiveFile,
79
      const   bool                    append,
80
      LOG4CXX_NS::helpers::Pool& pool) = 0;
81
};
82
83
LOG4CXX_PTR_DEF(RollingPolicy);
84
85
}
86
}
87
#endif
88