Apache Log4cxx Version 1.1.0
Loading...
Searching...
No Matches
filewatchdog.h
Go to the documentation of this file.
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#ifndef _LOG4CXX_HELPERS_FILEWATCHDOG_H
19#define _LOG4CXX_HELPERS_FILEWATCHDOG_H
20
21#include <log4cxx/logstring.h>
22#include <time.h>
24#include <log4cxx/file.h>
25#include <atomic>
26#include <thread>
27#include <condition_variable>
28
29namespace log4cxx
30{
31namespace helpers
32{
33
38class LOG4CXX_EXPORT FileWatchdog
39{
40 public:
41 virtual ~FileWatchdog();
45 static long DEFAULT_DELAY /*= 60000*/;
46
47 protected:
48 FileWatchdog(const File& filename);
49 virtual void doOnChange() = 0;
51 const File& file();
52
53 public:
57 void setDelay(long delay1);
58
59 void start();
60
61 private:
62 void run();
63 bool is_interrupted();
64
65
67 FileWatchdog& operator=(const FileWatchdog&);
68
69 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FileWatchdogPrivate, m_priv)
70};
71} // namespace helpers
72} // namespace log4cxx
73
74
75#endif // _LOG4CXX_HELPERS_FILEWATCHDOG_H
An abstract representation of file and directory path names.
Definition: file.h:41
Check every now and then that a certain file has not changed.
Definition: filewatchdog.h:39
void setDelay(long delay1)
Set the delay to observe between each check of the file changes.
FileWatchdog(const File &filename)
Definition: configuration.h:25