natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.8k stars 591 forks source link

Set perms on file #33

Closed ghost closed 7 years ago

ghost commented 7 years ago

I need to set the perms on the log file to 666. How should I achieve this? I can write code to do it in my app, but at what point should I do it? Is the file created when I instantiate the logger object or at the first log entry write? and does lumberjack maintain the perms when the file rolls? Perhaps I should simply create a empty file with the correct perms before starting lumberjack?

natefinch commented 7 years ago

Your guesses are accurate - lumberjack maintains the permissions of the original file, and when it rolls it creates a new file with the same permissions, so you can just create the file with the right permissions and then give that path to lumberjack, and it'll all work correctly.

On Tue, Nov 8, 2016, 6:43 AM Myles McDonnell notifications@github.com wrote:

I need to set the perms on the log file to 666. How should I achieve this? I can write code to do it in my app, but at what point should I do it? Is the file created when I instantiate the logger object or at the first log entry write? and does lumberjack maintain the perms when the file rolls? Perhaps I should simply create a empty file with the correct perms before starting lumberjack?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/natefinch/lumberjack/issues/33, or mute the thread https://github.com/notifications/unsubscribe-auth/ADCcyFOOVozkhMQzGy2xmCKM0RE-jc0Dks5q8GBQgaJpZM4KsVQN .