codeskyblue / gosuv

Deprecated!!! Process managerment writtern by golang, inspired by python-supervisor
MIT License
644 stars 180 forks source link

有没有log文件配置的地方 #16

Open woody-wu opened 7 years ago

woody-wu commented 7 years ago

启动之后会把日志保存在.gosuv/log/ 目录下, 这个文件好像会越来越大,一直存在 ,不知道没有设置日志文件大小的地方

codeskyblue commented 7 years ago

额,没想好怎么弄来着

woody-wu commented 7 years ago

能够按天生成日志文件, 还有设置每个日志文件的最大容量就好了, supervisord 就有这样的功能 logfile=/var/log/supervisord/supervisord.log ; (main log file;default $CWD/supervisord.log) logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) logfile_backups=10 ; (num of main logfile rotation backups;default 10) loglevel=info ; (log level;default info; others: debug,warn,trace)

codeskyblue commented 7 years ago

现记录一下,可参考的代码 https://github.com/natefinch/lumberjack/blob/v2.0/lumberjack.go#L68

exitNA commented 7 years ago

可以参考log4j的rollingfileappender,不知道go有没有类似的日志库可以使用。

codeskyblue commented 7 years ago

刚看了下,原来是supervisord的日志,gosuv不大一样,服务端的日志很少啊,真的要logrotate吗

c0b commented 7 years ago

but the programs generated logs under .gosuv/log/... increasing as time going, will definitely need rotation or reclaim if the service is designed for long time running

codeskyblue commented 7 years ago
foo:program --\
  +-- stdout.log
  +-- stdout-1.log.gz
  +-- stdout-2.log.gz

Any good ideas?

hoysoft commented 7 years ago

这里有日志文件处理例子 https://github.com/stathat/rotate