lumberjack icon indicating copy to clipboard operation
lumberjack copied to clipboard

Fallback writer in case of error

Open mholt opened this issue 2 years ago • 2 comments

Hi Nate,

Thanks again for Lumberjack. Been using it for years now in Caddy!

We have some users (including myself, heh) who have incorrect permissions on their log folder/files. This leads to errors like write error: error getting log file info in the logs, but the actual log message is lost to oblivion. :sweat_smile:

Since Lumberjack hides the underlying io.Writer, I can't figure out a way to wrap the Write() method and, if there's an error, dump the log message to stderr as a fallback.

Would this be a feature you could support?

It would be very helpful if we didn't lose log messages on an external issue like permissions.

Thanks!

mholt avatar Jul 19 '23 22:07 mholt

Hi Matt! This is a tricky one. This sounds like something that should be addressed for v3, which uses a constructor method specifically to do some sanity checks on startup.

What's your timeline for getting this done?

natefinch avatar Jul 21 '23 20:07 natefinch

Sounds good to me. It's not urgent. Over the years we've had a number of questions about this, so I've learned it's not an isolated problem for sysadmins to have the wrong permissions configured. :sweat_smile:

Thank you for Lumberjack

mholt avatar Jul 21 '23 20:07 mholt