vinser/flibgolite

Option to disable log rotation

freehck opened this issue · 2 comments

Integrated log rotation is a good option, but for some corner cases it would be good to have an option to disable it.
For example if you use /dev/stdout as your log file.

Right now I'm running a docker container with flibgolite, and logs are interrupted every 1-2 days. Restart helps. The only suspicion is log rotation.

I've got a confirmation of the hypothesis that specifically log rotation is responsible for log interruption.

Have a look please:

~ # grep ^logs: -A3 /flibgolite/config/config.yml
logs:
  # Logs are here
  OPDS: "/dev/stdout"
  SCAN: "/dev/stdout"
~ # ls -lh /dev/stdout*
-rw-r--r--    1 root     root       31.1K Jul 18 02:29 /dev/stdout
-rw-r--r--    1 root     root        1.0M Jul 18 02:29 /dev/stdout-0
lrwxrwxrwx    1 root     root          15 Jul 16 21:04 /dev/stdout-1 -> /proc/self/fd/1

Obviously /dev/stdout file is surely not supposed to be rotated.

Btw, the ability to redirect logging to devfs is one of the reasons why linux daemons usually don't handle log rotation but leave this function to external tools such as logrotate, and implement instead only a way to reopen log files. Often HUP or USR1 signal handlers are responsible for this. Often they also reload the configuration file.

I did a stress test of the rlog package with dozens of goroutines when 2 loggers were writing in the same file and got program hangup. That is, it is not related to the output to the stdout.

Therefore, I need to rethink the logging process to resolve issue #2, and solve the issues of redirecting logs to stdout and writing both logs in one file.