ServerLogSaver
ServerLogSaver
Description
Simply put, this will backup the server.log file to a directory, and then clear the existing server.log file. This is to reduce RAM usage of the server host and effectively reduce lag for server players.
Most of the functions in this are configurable, such as backup location, time delay between backups, choice of Size and Time rotations and more!
Download the Jar
- ServerLogSaver v2.1.1
- ServerLogSaver v2.1.0
- ServerLogSaver v2.0.2
- ServerLogSaver v2.0.1
- ServerLogSaver v2.0
Download the Source
Old Source ServerLogSaver src v0.1b
Commands
- /sls copy
- /sls zip
Current Features
- User defined time for backup intervals (default time is 1 day, 1440 minutes)
- Backups are time stamped for ease of use
- Compress the logs
- Check for 0 byte content
- Console notice (optional)
- Choice of time/size/restart rotations (Time in minutes/Size in KB/Restart only backs up on server start)
- User defined backup storage location
- User defined backup file names (prefix and time setup)
- In-game command to do backups on will
- Choose the number of logs to keep before purging
To-Do
- Record commands used in a separate file (Probably make a separate plugin for this)
- need more ideas, feed back would help :D
Change-Log
Version 2.1.1
- Updated to 1.2.5 R4.0
Version 2.0.2
- No longer backs up as soon as the server starts with 'time' rotation
Version 2.0.1
- Added 'restart' rotation choice
Version 2.0
- Complete re-code
- Added in-game commands
- Updated to latest config
@bigscary
Thanks for the nice feed back. Basically how this reduces RAM usage is that when the server is running, the server.log is continuously being written to and is always being opened. So having a large log file always being opened is obviously going to increase the RAM usage.
I have actually seen this on other servers where the server often lags or crashes because of 1GB or larger logs and that is why i made this plugin. I hope that explains it :D
@w7gamer
I literally just tested this with the 1550 build and got no such error, runs perfectly fine, and have had no other reports of this so i am assuming that either you are running a failed build of craftbukkit or there is something else wrong. Is it enabling when you first run the server, when do you get this error.
How does this save ram and reduce lag? I don't think the logs are kept in memory... aren't we just appending to the text file?
Anyway it's nice to have the logs divided up over time, easier to find specific entries (like yesterday @ 2pm, etc). Thanks for that!
Hmm, see no ticket adder. here's errors: 17:59:28 [SEVERE] Error occurred while enabling ServerLogSaver v2.0 (Is it up to date?): null java.lang.NullPointerException at me.laserhog.ServerLogSaver.ServerLogSaver.onEnable(ServerLogSaver.jav a:124) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:188) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader .java:957) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage r.java:280) at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:184) at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:167 ) at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:337) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:324) at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:161) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:388) at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
Fails completely under MC 1.0.1 Bukkit dev builds... Ticket will be created with error messages.
@AgentSnazz
If you have this on time based rotations that is exactly what it does. As soon as the server is started/reloaded it makes a new log backup and then continues on the specified schedule, backing up every however long you set the delay for.
This doesn't happen with size based rotations however as that is purely based on the size of the log and will only ever back up if the log is bigger than the specified size.
Let me throw my vote in for a new-log-on-server-start option. Up until now I've been using a startup script that, in pseudocode, does this:
Move and rename server.log to logs\[date].log start server
@FurmigaHumana
Im not sure what you mean by this.
This auto clears the server.log after each backup
@saturnineNL
So what you're wanting is to have it make a backup of the server.log on a server crash? Im not sure there's an event for that but ill look into it. Ill make it configurable too so you dont HAVE to have it back up on a crash.
On another note, i have been busy re-coding this plugin so it can have many new features (such as this) easily added.
@Laserhog
This can be a huge problem, when my server crashes and auto reboots it wipes the logfile in the process. Even before i can check the log to see what was causing the crash. I rent a server and this is how the hosting party is doing it. Thats why i am going to try your plugin.
Dont know if this is possible, but if you can hook the backup to the force save event when a server is about to restart. It would really fix my above problem. In the meanwhile i'll just try to set the log backup process to a high interval.
Please, tell me, i can disable or auto remove the server.log with your plugin?
@JokerLand69
Thanks for the feedback. Sorry i didnt notice your comment until now.....
In the latest version you can actually do both of those things; Version 1.1
And yes the plugin is still compatible with CB 1337
Ideas to add:
Because my host has change the directory and the name of the logs, and it delete it every day :/
Great job !
@Microskies
At default the time is set to 1 day in minutes, which is 1440 minutes. In the next version, which will be a complete rewrite, i will make it configurable so as people can choose what method they wish to use, be it minutes or days or seconds or what ever.
As to the "Making a new long on each start up" problem. Well all i can say is, why would you need to keep on restarting your server so much that its a bother? Maybe in the time that you are continuously restarting you either change the Rotation method to SIZE based rather than TIME based, or leave this plugin out until you are stable enough where you aren't continuously restarting.
If this problem is really bothering everyone then i will really look into it in the next update, when ever that may be, but as of now i think it is working perfectly well and there is always the backdoor ways i stated above.
@Laserhog
Would you be able to make a daily back-up, where the log backs up at a TIME rather than counting the minutes, I assume this would get rid of the problem of a new log on a new start-up?
@ssechaud
No i don't know what you mean.
Sorry.
@SirMonsterSlayer
One solution to this problem you are having, it making a new backup log each time you restart the server is to use the Size based rotations. This way it will only backup if and when the server.log file is actually greater than the specified size in the config.
Really like this plugin, however it would be pretty cool if it could split the logs and zip them up for each time the server runs. So we would get a full log of the server in each zip, just now it just splits it up mid boot. Maybe do a check and only split the log between each "[INFO] Starting minecraft server version bla bla".
Know what I mean?
@SirMonsterSlayer
As i said in my previous post, i haven't had time to do anything at all on this plugin and wont be able to for another few weeks. When i get back i am going to do a whole HUGE code revamp and overhaul. Clean out all my noobish code and replace it with some smarter code. Sorry, i will look into this and all my other To-do items when i get time.
@Gibstick
An example of a custom location is as such.
C:\Users\OEM\Desktop\Test
Then it will begin to make the log files in the Test folder on the Desktop. I have however not been updating, maintaining or testing this due to other commitments (eg. school) and i will not begin to again until after this school year ends (another 4 or so weeks). Any problems that may occur may be because this plugin is still at 1060/1185 CraftBukkit build.