Closed lynxthecat closed 10 months ago
I disagree, if the config is invalid it should be ignored and defaults used shortly before aborting.
I suppose you do put out the config file name in the validation:
root@OpenWrt-1:~# cat /var/log/cake-autorate.log
ERROR; 2023-07-05-11:18:13; 1688552293.314561; The key: 'test' in config file: '/root/cake-autorate/config.primary.sh' is not a valid config entry.
ERROR; 2023-07-05-11:18:13; 1688552293.349858; The config file: '/root/cake-autorate/config.primary.sh' contains 1 error(s). Exiting now.
DEBUG; 2023-07-05-11:18:13; 1688552293.354934; Starting: cleanup_and_killall with PID: 16911
INFO; 2023-07-05-11:18:13; 1688552293.356579; Stopping cake-autorate with PID: 16911 and config: /root/cake-autorate/config.primary.sh
INFO; 2023-07-05-11:18:13; 1688552293.358148; Killing all background processes and cleaning up temporary files.
SYSLOG; 2023-07-05-11:18:14; 1688552294.366726; Stopped cake-autorate with PID: 16911 and config: /root/cake-autorate/config.primary.sh
DEBUG; 2023-07-05-11:18:33; 1688552313.682987; Starting: cleanup_and_killall with PID: 17004
INFO; 2023-07-05-11:18:33; 1688552313.685013; Stopping cake-autorate with PID: 17004 and config: /root/cake-autorate/config.primary.sh
INFO; 2023-07-05-11:18:33; 1688552313.686777; Killing all background processes and cleaning up temporary files.
SYSLOG; 2023-07-05-11:18:34; 1688552314.695214; Stopped cake-autorate with PID: 17004 and config: /root/cake-autorate/config.primary.sh
DEBUG; 2023-07-05-11:41:09; 1688553669.360710; Starting: cleanup_and_killall with PID: 17285
INFO; 2023-07-05-11:41:09; 1688553669.361692; Stopping cake-autorate with PID: 17285 and config: /root/cake-autorate/config.primary.sh
INFO; 2023-07-05-11:41:09; 1688553669.362506; Killing all background processes and cleaning up temporary files.
SYSLOG; 2023-07-05-11:41:10; 1688553670.370366; Stopped cake-autorate with PID: 17285 and config: /root/cake-autorate/config.primary.sh
DEBUG; 2023-07-05-11:41:21; 1688553681.089878; Starting: cleanup_and_killall with PID: 17382
INFO; 2023-07-05-11:41:21; 1688553681.091533; Stopping cake-autorate with PID: 17382 and config: /root/cake-autorate/config.primary.sh
INFO; 2023-07-05-11:41:21; 1688553681.093401; Killing all background processes and cleaning up temporary files.
SYSLOG; 2023-07-05-11:41:22; 1688553682.101258; Stopped cake-autorate with PID: 17382 and config: /root/cake-autorate/config.primary.sh
But I wonder what all the extra entries relate to? Presumably errors before the log_file_path is set. Perhaps those don't matter so much.
@rany2 the config file validation occurs here:
https://github.com/lynxthecat/cake-autorate/blob/c7bba537d06acc3e3b78ae8274241f68aab9a393/cake-autorate.sh#L1748
before the log file path is set here:
https://github.com/lynxthecat/cake-autorate/blob/c7bba537d06acc3e3b78ae8274241f68aab9a393/cake-autorate.sh#L1812
leading to logging out to /var/log/cake-autorate.log when a config file is invalid.
The log file path should get set before the config file validation, right? Or am I missing something?