Skip to content

Commit

Permalink
Merge pull request #990 from hprange/improvement/apache-adaptor-logging
Browse files Browse the repository at this point in the history
Improve Apache adaptor error message when it's not possible to write to the log
  • Loading branch information
darkv authored Jul 13, 2022
2 parents 06aef3f + c743c44 commit 7f6249c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Utilities/Adaptors/Adaptor/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ void WOLog(int level, const char *format, ...)
strftime(timestamp, sizeof(timestamp), "%d-%b-%Y %T - ", t);
WA_unlock(logMutex);
#endif
errno = 0;
log = fopen(logPath, "a+");
if (log != NULL) {
#if defined(TIMESTAMP_LOG_MESSAGES)
Expand All @@ -227,7 +228,7 @@ void WOLog(int level, const char *format, ...)
}else{
// TODO - figure out how to report this for other web servers
#if defined(APACHE)
ap_log_error(APLOG_MARK, APLOG_ERR, 0, _webobjects_server, "Failed to append to log file '%s'. This can occur when the file is not writable by the child httpd process. A workaround is to change the ownership of the file to match the child httpd process.", logPath);
ap_log_error(APLOG_MARK, APLOG_ERR, 0, _webobjects_server, "Failed to append to log file '%s': %s. This can occur when the file is not writable by the child httpd process. A workaround is to change the file ownership to match the child httpd process. Beware that other restrictions may apply when running Apache using systemd with the PrivateTmp option active.", logPath, strerror(errno));
#endif
}
}
Expand Down

0 comments on commit 7f6249c

Please sign in to comment.