ALways log to syslog when writing to the logfile failed

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-08-09 19:19:04 +02:00
parent a2d1d16e61
commit e6f5bf7901
2 changed files with 4 additions and 7 deletions
-6
View File
@@ -141,12 +141,6 @@ bool readFTLtoml(struct config *oldconf, struct config *newconf,
struct conf_item *old_conf_item = oldconf != NULL ? get_conf_item(oldconf, i) : NULL;
struct conf_item *new_conf_item = get_conf_item(newconf, i);
// Do not read config.files.log.ftl from the TOML file if it has been
// set to NULL due to permissions issues during startup
if(config.files.log.ftl.v.s == NULL &&
new_conf_item == &newconf->files.log.ftl)
continue;
// First try to read this config option from an environment variable
// Skip reading environment variables when importing from Teleporter
// If this succeeds, skip searching the TOML file for this config item
+4 -1
View File
@@ -289,6 +289,7 @@ void __attribute__ ((format (printf, 3, 4))) _FTL_log(const int priority, const
va_end(args);
add_to_fifo_buffer(FIFO_FTL, buffer, prio, len > MAX_MSG_FIFO ? MAX_MSG_FIFO : len);
bool logged = false;
if(config.files.log.ftl.v.s != NULL)
{
// Open log file
@@ -310,6 +311,8 @@ void __attribute__ ((format (printf, 3, 4))) _FTL_log(const int priority, const
// Close file after writing
fclose(logfile);
logged = true;
}
else if(!daemonmode)
{
@@ -317,7 +320,7 @@ void __attribute__ ((format (printf, 3, 4))) _FTL_log(const int priority, const
syslog(LOG_ERR, "Writing to FTL\'s log file failed!");
}
}
else
if(!logged)
{
// Syslog logging
va_start(args, format);