-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for automatic removal of old logs #432
Commits on Feb 17, 2019
-
Add support for automatic removal of old logs
GetOverdueLogNames(string log_directory, int days) will check all filenames under log_directory, and return a list of files whose last modified time is over the given days (calculated using difftime()). So that we can easily for unlink all files stored in the returned vector.
Configuration menu - View commit details
-
Copy full SHA for 5747841 - Browse repository at this point
Copy the full SHA 5747841View commit details
Commits on Feb 18, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 4dd1386 - Browse repository at this point
Copy the full SHA 4dd1386View commit details
Commits on Aug 21, 2019
-
Configuration menu - View commit details
-
Copy full SHA for d8d0c14 - Browse repository at this point
Copy the full SHA d8d0c14View commit details -
Configuration menu - View commit details
-
Copy full SHA for 55cfc38 - Browse repository at this point
Copy the full SHA 55cfc38View commit details -
Add support for automatic removal of old logs
In this commit, at the end of LogFileObject::Write, it will perform clean up for old logs. It uses GetLoggingDirectories() and for each file in each directory, it will check if a file is a log file produced by glog. If it is, and it is last modified 3 days ago, then it will unlink() this file. (It will only remove the project's own log files, it won't remove the logs from other projects.) Currently it is hardcoded to 3 days, I'll see if this can be implemented in a more flexible manner.
Configuration menu - View commit details
-
Copy full SHA for 7af21ae - Browse repository at this point
Copy the full SHA 7af21aeView commit details -
The log cleaner can be enabled and disabled at any given time. By default, the log cleaner is disabled. For example, this will enable the log cleaner and delete the log files whose last modified time is >= x days google::EnableLogCleaner(x days); To disable it, simply call google::DisableLogCleaner(); Please note that it will only clean up the logs produced for its own project, the log files from other project will be untouched.
Configuration menu - View commit details
-
Copy full SHA for cbfd1e3 - Browse repository at this point
Copy the full SHA cbfd1e3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5eef96f - Browse repository at this point
Copy the full SHA 5eef96fView commit details -
logging: log_cleaner: remove the range-based loops
Also replaced the hardcoded overdue days with the correct variable.
Configuration menu - View commit details
-
Copy full SHA for b8a61d7 - Browse repository at this point
Copy the full SHA b8a61d7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6dc3e0f - Browse repository at this point
Copy the full SHA 6dc3e0fView commit details
Commits on Aug 22, 2019
-
logging: log_cleaner: Remove redundant filename stripping
Previously the full path to a file is passed into IsGlogLog(), and then std::string::erase() is used to get the filename part. If a directory name contains '.', then this function will be unreliable. Now only the filename it self is passed into IsGlogLog(), so this problem will be eradicated.
Configuration menu - View commit details
-
Copy full SHA for 6cb55b2 - Browse repository at this point
Copy the full SHA 6cb55b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3d715d7 - Browse repository at this point
Copy the full SHA 3d715d7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4136403 - Browse repository at this point
Copy the full SHA 4136403View commit details -
Configuration menu - View commit details
-
Copy full SHA for a1a9dc8 - Browse repository at this point
Copy the full SHA a1a9dc8View commit details -
logging: IsGlogLog: match filename keyword by keyword
Splitting a filename into tokens by '.' causes problems if the executable's filename contains a dot. Filename should be matched keyword by keyword in the following order: 1. program name 2. hostname 3. username 4. "log"
Configuration menu - View commit details
-
Copy full SHA for 77a1f39 - Browse repository at this point
Copy the full SHA 77a1f39View commit details