Would it be possible to create a log-rotation plugin that changes the log file when it exceededs a specific size or a time schedule? As i saw both the logger in the Server class and the logFile in the MainLogger class are private/protected, so it seems impossible to overwrite them whilest the server is running. Any workarounds that you might know?
I see, good to know. Apart from it, is it save to change the content of the server.log file whilest the server is running? Or will it throw errors when accessed?
Depends on the OS. On linux you can probably blow it away without any issues. On Windows you're likely to get trouble from it.
Apparently there are no issues accessing/setting the file contents of server.log at windows either, so i was able to create a plugin that does log rotation with some basic features: https://github.com/thebigsmileXD/PMMPLogRotate/releases/tag/1.0.0
1. It may have concurrency issues. This may cause data loss, because logger IO is threaded, and contents might be written into the log while you are slicing it. 2. It may have memory issues. Have you stress-tested it with a 16-GB-large log file?
30GB files seems to be handled ok. It is handled via tasks, except for the startup split option, so it might not create too big of an issue The first issue did not happen to me yet, but good idea, might take it into consideration, thanks for the hint.