Skip to content
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

Improve Apache adaptor error message when it's not possible to write to the log #990

Merged
merged 2 commits into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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