log4net - how to limit number of log files / size?
I've got the following config, but neither the number of files nor the size seems to be limited. There are a number of files that exceed 5MB (one is 127MB!) and the number of files just keeps increasing.
the log4net config in umbraco is actually configured to roll over based on date not size. so the logfile will grow and grow until the date changes.
setting log WARN will certainly make the file smaller however if you want to ensure file sizes are kept to a specific size, set the rollingStyle to either Size or Composite (Date and Size)
<rollingStyle value="Composite" />
just setting this and logging will just wipe the file when it reaches a size and start again. if you want to keep a history for logging then also set number of backups to keep
<maxSizeRollBackups value="10" />
This will keep 5 backups everytime the file rolls over (by default umbracotracelog.txt.1, 2, etc)
so the following will stop the log growing past 5MB and keep only 5 versions (so it should never go past 30MB for logging)
log4net - how to limit number of log files / size?
I've got the following config, but neither the number of files nor the size seems to be limited. There are a number of files that exceed 5MB (one is 127MB!) and the number of files just keeps increasing.
Adding the following in the <root> node seems to do the trick:
<priority value="WARN" />
The log level order is:
DEBUG
INFO
WARN
ERROR
FATAL
Setting the value to "WARN" will log WARN, ERROR, and FATAL.
the log4net config in umbraco is actually configured to roll over based on date not size. so the logfile will grow and grow until the date changes.
setting log WARN will certainly make the file smaller however if you want to ensure file sizes are kept to a specific size, set the rollingStyle to either
Size
orComposite
(Date and Size)just setting this and logging will just wipe the file when it reaches a size and start again. if you want to keep a history for logging then also set number of backups to keep
This will keep 5 backups everytime the file rolls over (by default umbracotracelog.txt.1, 2, etc)
so the following will stop the log growing past 5MB and keep only 5 versions (so it should never go past 30MB for logging)
is working on a reply...