Page 1 of 1

MM feature request

Posted: Mon Mar 11, 2013 4:57 am
by Jandrana
I while ago, Admin told be about the "log.txt" feature that will print a stack trace an other usefull info, when a script causes errors.

After that I found it much easier to analyze script problems.

Usually I have multiple MM processes running. Yesterday I had a strange error happening with the RoM bot.
I looked into the log.txt and was thinking about posting the error here in the forum. Because it was very late
I decided to do it today. But it seems the "log.txt" gets overwritten each time an error occurs in a script.

My suggestion is to append to the log.txt instead of overwriting it. Maybe add on option to "config.lua"
as an advanced feature.

What do you think?

Re: MM feature request

Posted: Mon Mar 11, 2013 10:15 am
by Administrator
log.txt is only overwritten when restarting MicroMacro. The problem is that if you run multiple instances of MicroMacro, they will fight overwhich one is writing to the log file.

It should be up to the individual scripts to handle most logging. It wouldn't take much to get a stack trace added to RoMBot's logs.

Re: MM feature request

Posted: Tue Mar 12, 2013 7:22 am
by Jandrana
If I understood you correctly, it should be done by the bot itself. Then rock5 should take a look at this.

But I think it's still not really "clean" that all MM processes overwrite the same log file.

I need to take another attempt to compile MM myself. Last time I gave up after strange linker fixup errors...

Re: MM feature request

Posted: Tue Mar 12, 2013 9:53 am
by Administrator
While I agree with you, I just wasn't able to come up with a good way to handle multiple instances of MicroMacro each having separate logs. I actually, at one point, experimented with the first copy opening up some shared memory which would be used to identify and assign each other copy unique IDs, which could then be used in the log name. Sure, it worked, but it seemed hackish and over-the-top.

I suppose it could log by base script name, but I'm not sure I like that much, either.

Re: MM feature request

Posted: Tue Mar 12, 2013 10:30 am
by lisa
you could open and add to the file then save, all at the same time so that the info keeps getting added. This would of course make the file rather large over time which isn't ideal, by doing this though there wouldn't be any lost error reports.
You could set it up to clear the file each day though, only issue would be the midnight changing to next day to lose the reports that just occured.
Would be just a matter of having the day of the month as first line and then compare first line of the file with the current day according to os.date, if they are different then redo the file with the current day.

Either that or just create a log file using the bot by using the aterror function thingy, I have no idea how to do a stack trace though.

Re: MM feature request

Posted: Tue Mar 12, 2013 10:57 am
by Administrator
debug.traceback() returns the stack trace.

Re: MM feature request

Posted: Tue Mar 12, 2013 7:36 pm
by lisa
Ok I'll post some stuff in the logger topic as it seems to be more about logging now, rather than continue it here in the MM section.
http://www.solarstrike.net/phpBB3/viewt ... 637#p48637

Re: MM feature request

Posted: Wed Apr 17, 2013 6:26 am
by dx876234
deleted