Error upfront when the configured logFilePath is not writable

Description

The validateLogFilePath() function does not check if the configured logFilePath directory is writable, as it correctly assumes Lumberjack (the underlying logger) errors for a non-writable log file, but this is only done lazily on the first call to lumberjack.Logger.Write(), which is then subsequently ignored by log.Logger.Printf ... not at the time of initialization.

Include an upfront permission check that can cause SG to fail to start if the configured log file path is not writable. This isn't perfect if somebody changes the permissions between the initial check and the subsequent logging, but we could also change logf() to call l.Output instead of l.Printf in order to get the write-time error.

Activity

Show:

CB robot October 28, 2021 at 1:31 PM

Build sync_gateway-3.0.0-477 contains sync_gateway commit 5a069ef with commit message:
: Error upfront if logFilePath is unwritable (#5312)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Sprint

Fix versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created October 20, 2021 at 7:35 PM
Updated November 9, 2021 at 5:43 PM
Resolved October 28, 2021 at 1:58 PM
Instabug