Align application logging events to actual application defaults (#2170)

* Align application logging events to actual application defaults for --monitor operations
This commit is contained in:
abraunegg 2022-10-07 06:52:38 +11:00 committed by GitHub
parent e08c89ad0b
commit fd0a028276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 11 deletions

2
config
View File

@ -27,7 +27,7 @@
# skip_size = "1000"
# dry_run = "false"
# min_notify_changes = "5"
# monitor_log_frequency = "5"
# monitor_log_frequency = "6"
# monitor_fullscan_frequency = "12"
# sync_root_files = "false"
# classify_as_big_delete = "1000"

View File

@ -481,7 +481,7 @@ See the [config](https://raw.githubusercontent.com/abraunegg/onedrive/master/con
# skip_size = "1000"
# dry_run = "false"
# min_notify_changes = "5"
# monitor_log_frequency = "5"
# monitor_log_frequency = "6"
# monitor_fullscan_frequency = "12"
# sync_root_files = "false"
# classify_as_big_delete = "1000"
@ -654,7 +654,7 @@ Example:
# dry_run = "false"
monitor_interval = "600"
# min_notify_changes = "5"
# monitor_log_frequency = "5"
# monitor_log_frequency = "6"
```
#### monitor_fullscan_frequency
@ -667,13 +667,37 @@ Setting this value to 24 means that the full scan of OneDrive and checking the i
Example:
```text
# min_notify_changes = "5"
# monitor_log_frequency = "5"
# monitor_log_frequency = "6"
monitor_fullscan_frequency = "24"
# sync_root_files = "false"
# classify_as_big_delete = "1000"
```
**Note:** When running in --monitor mode, at application start-up, a full scan will be performed to ensure data integrity. This option has zero effect when running the application in --synchronize mode and a full scan will always be performed.
**Note:** When running in --monitor mode, at application start-up, a full scan will be performed to ensure data integrity. This option has zero effect when running the application in `--synchronize` mode and a full scan will always be performed.
#### monitor_log_frequency
This configuration option controls the output of when logging is performed to detail that a sync is occuring with OneDrive when using `--monitor` mode. The frequency of syncing with OneDrive is controled via 'monitor_interval'.
By default without configuration, 'monitor_log_frequency' is set to 6.
By default, at application start-up when using `--monitor` mode, the following will be logged to indicate that the application has correctly started and performed all the initial processing steps:
```
Configuring Global Azure AD Endpoints
Initializing the Synchronization Engine ...
Initializing monitor ...
OneDrive monitor interval (seconds): 300
Starting a sync with OneDrive
Syncing changes from OneDrive ...
Performing a database consistency and integrity check on locally stored data ...
Sync with OneDrive is complete
```
Then, based on 'monitor_log_frequency', the following will be logged when the value is reached:
```
Starting a sync with OneDrive
Syncing changes from OneDrive ...
Sync with OneDrive is complete
```
**Note:** The additional log output `Performing a database consistency and integrity check on locally stored data ...` will only be displayed when this activity is occuring which is triggered by 'monitor_fullscan_frequency'.
#### min_notify_changes
This option defines the minimum number of pending incoming changes necessary to trigger a desktop notification. This allows controlling the frequency of notifications.
@ -683,7 +707,7 @@ Example:
# dry_run = "false"
# monitor_interval = "300"
min_notify_changes = "50"
# monitor_log_frequency = "5"
# monitor_log_frequency = "6"
# monitor_fullscan_frequency = "12"
```

View File

@ -75,7 +75,7 @@ final class Config
longValues["monitor_interval"] = 300;
longValues["skip_size"] = 0;
longValues["min_notify_changes"] = 5;
longValues["monitor_log_frequency"] = 5;
longValues["monitor_log_frequency"] = 6;
// Number of N sync runs before performing a full local scan of sync_dir
// By default 12 which means every ~60 minutes a full disk scan of sync_dir will occur
// 'monitor_interval' * 'monitor_fullscan_frequency' = 3600 = 1 hour

View File

@ -1550,7 +1550,7 @@ int main(string[] args)
string startMessage = "Starting a sync with OneDrive";
string finishMessage = "Sync with OneDrive is complete";
// perform a --monitor sync
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval)) {
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval) || (fullScanRequired) ) {
// log to console and log file if enabled
log.log(startMessage);
} else {
@ -1567,7 +1567,7 @@ int main(string[] args)
log.error("ERROR: The following inotify error was generated: ", e.msg);
}
}
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval)) {
if ((cfg.getValueLong("verbose") > 0) || (logMonitorCounter == logInterval) || (fullScanRequired) ) {
// log to console and log file if enabled
log.log(finishMessage);
} else {
@ -1772,7 +1772,7 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
}
} else {
// sync from OneDrive first before uploading files to OneDrive
if (logLevel < MONITOR_LOG_SILENT) log.log("Syncing changes from OneDrive ...");
if ((logLevel < MONITOR_LOG_SILENT) || (fullScanRequired)) log.log("Syncing changes from OneDrive ...");
// For the initial sync, always use the delta link so that we capture all the right delta changes including adds, moves & deletes
logOutputMessage = "Initial Scan: Call OneDrive Delta API for delta changes as compared to last successful sync.";
@ -1829,7 +1829,7 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
//
// To change this behaviour adjust 'monitor_interval' and 'monitor_fullscan_frequency' to desired values in the application config file
if (fullScanRequired) {
log.vlog("Performing Database Consistency Integrity Check .. ");
log.log("Performing a database consistency and integrity check on locally stored data ... ");
sync.scanForDifferencesDatabaseScan(localPath);
// handle any inotify events that occured 'whilst' we were scanning the database
m.update(true);