ethanmoffat / etheos

[Eth]an's [E]ndless [O]nline [S]erver - fork of eoserv project
zlib License
13 stars 8 forks source link

Add support for log file rotation #52

Closed ethanmoffat closed 2 years ago

ethanmoffat commented 2 years ago

Options are as follows:

Rotation will occur on either file size or time interval. Rotation is disabled if file size/interval are both unset.

Example configuration (from dev/test instances) - rotate daily, keeping 7 total files (week's worth of logs)

EnableLogRotation=true
LogRotationSize=0
LogRotationInterval=1d
LogFileLimit=7
LogFileDirectory=/logs/{env}

LogOut and LogErr are both ignored when log rotation is enabled.

Potentially undesirable behavior: ~1. Only one log file is deleted when log file limit is set, instead of all files over the limit number.~ Fixed in 8a406f5967da356b2e69c752f6a2334e4dabba05

  1. Most recent existing log file is not opened in append mode on application start.
ethanmoffat commented 2 years ago

Closing this in favor of introducing a more configurable Logger class with log providers.