What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[Plugin] LumberJack - automated log file management

rrrix

New Member
Joined
Jul 11, 2010
Messages
3,449
Reaction score
61
In my other projects tend to generate tons of debugging data when building plugins and such. I found my DB logs directory was nearly 4GB from when I first installed DB.

So, this plugin will:
* GZip compress log files that haven't been updated in the last 30 minutes (e.g. logs from previous DB sessions) for easy uploading to forums as attachments for you nubs
* Delete log files older than 1 day
* Uses it's own threads for compression/deletion so it doesn't slow down the BehaviorTree.

Above settings can be easily tweaked - just open the .cs and find these:

parameters to TimeSpan are: TimeSpan(days, hours, minutes, seconds);

Code:
        // Compress after 30 minutes of not being updated
        static TimeSpan compressAfter = new TimeSpan(0, 0, 30, 0);


        // Delete after 1 day
        static TimeSpan deleteAfter = new TimeSpan(1, 0, 0, 0);

It's fully compatible with running more than 1 instance from a shared DB directory that runs multiple bots.

Enjoy,

rrrix
 

Attachments

Last edited:
Wonderfull adition to the plugin now that we start to reach a fully afk-able status!
 
I was wondering, checked out the code myself a bit but i'm not that much into C#. Is there any change to have this plugin compatible with HonorBuddy as well?
 
I haven't used HB in ages, but I doubt it will work. I'm all WoW'd out if you know what I mean.
 
I guess i know what you mean, diving back into it a little these days with diablo seeming less profitable nowadays. But this is one of this plugins you don't miss until its gone :P might check if i can convert it for honorbuddy someday, but i have even less of an idea how honorbuddy plugins work than i do at demonbuddy :)
 
im getting really bad compression level with this, 10M log come down to 9m log, if i hand zip that file with 7z it goes down to a mere 900k. Im only i having this problem?
 
not so good <.< compress rate so bad :<

Compression is merely an additional "nice to have" here. The primary function - deleting old log files after 24 hours - is all we really care about. The included compression systems with .NET (GZipStream) is notoriously bad, but, it comes installed by default and is available for all users.

To use any other compression system (e.g. zip, 7z, rar, etc) would require a 3rd party library in binary form, which involves 2 problems:

1) Licensing
2) Distribution (we are not allowed to post binaries to DB forums without included source code).

So the short answer, is, no, I won't be improving the compression features of this plugin, since it doesn't matter that much and is too much of a pain in the ass.
 
Compiler Error: c:\Users\ZTJY\Desktop\DemonBuddy\Plugins\LumberJack\LumberJack.cs(10,12) : error CS0234: The type or namespace name 'CommonBot' does not exist in the namespace 'Zeta' (are you missing an assembly reference?)
Compiler Error: c:\Users\ZTJY\Desktop\DemonBuddy\Plugins\LumberJack\LumberJack.cs(12,12) : error CS0234: The type or namespace name 'Internals' does not exist in the namespace 'Zeta' (are you missing an assembly reference?)



What am i doing wrong!?
 
My bad - i forgot to upload the new zip after the forum resets a couple of weeks ago.
 
In my other projects tend to generate tons of debugging data when building plugins and such. I found my DB logs directory was nearly 4GB from when I first installed DB.

So, this plugin will:
* GZip compress log files that haven't been updated in the last 30 minutes (e.g. logs from previous DB sessions) for easy uploading to forums as attachments for you nubs
* Delete log files older than 1 day
* Uses it's own threads for compression/deletion so it doesn't slow down the BehaviorTree.

Above settings can be easily tweaked - just open the .cs and find these:

parameters to TimeSpan are: TimeSpan(days, hours, minutes, seconds);

Code:
        // [B]Compress after 30 minutes of not being updated
        static TimeSpan compressAfter = new TimeSpan(0, 0, 30, 0);[/B]


        // Delete after 1 day
        static TimeSpan deleteAfter = new TimeSpan(1, 0, 0, 0);

It's fully compatible with running more than 1 instance from a shared DB directory that runs multiple bots.

Enjoy,

rrrix

but in my files are

private static readonly TimeSpan CompressDurationAfter

whats the difference?
 
for some unknown reason i like to rename DB.exe to something else, if doing so this will not delete your logs :)
(noticed after C:\ almost empty lol)

Code:
                //where p.ProcessName == "Demonbuddy"
                where p.ProcessName == System.Diagnostics.Process.GetCurrentProcess().ProcessName

this should work
 
Back
Top