I know log rotation is a feature seen in application servers like Oracle’s Weblogic. I would like to understand:
- What is actually meant by log rotation?
- What is it useful?
- Who performs the task?
Is this duty performed by the logging frameworks that the developers use or is it handled by the servers themselves? Would log rotation be available in a server like Weblogic if the application doesn’t use any logging framework(not java.util.logging
) and simply rely on System.out.println()
and System.err.println()
etc?
3
- Log rotation simply means that log files, once they are too old or too big (there are actually several metrics that can apply here), will be renamed or even deleted and new incoming log data is directed into a new fresh file (at the same location).
- The main purpose of log rotation is a) avoiding disk overflow and b) keeping the log files small enough so viewers can still open them.
- Given this quick summary, I think it’s obvious that the beneficiary of log rotation is not the developer but the admin who has to keep the application running. It’s thus usually their responsibility. I.e., as a developer you can just log. You may even suggest a default configuration that redirects log output to a file. And if the application system provides its own log rotation you may suggest a configuration for that, too. It is, however, the admin/user that runs the application and thus has to decide whether keeping ten or hundreds of log files makes sense for them (and their systems). I’d conclude that, even though some applications come with their own rotation systems, running
logrotate
or similar on a server is “more to the purpose” than having log file rotation “dictated” by the developer.