[MUD-Dev] Technical programming question (circular buffers & logging)

Ben Greear greear at cyberhighway.net
Thu Jul 15 18:26:12 CEST 1999


Chris Gray wrote:
> 
> [Ben Greear:]
> 
> > So, what I want to do is modify my logging class (basically just
> > an ofstream with some flags tacked on it).  I was thinking about
> > making it a sort of ring-buffer where it just kept the last 50k
> > or some other nice round number.
> 
> I've used that technique both in my MUD and at work. It works pretty well.
> Rather than getting complex and logging full text messages, however, we've
> tended to just log simpler things. My MUD just logs a pointer to a text
> message, and a single 32 bit value. If the system itself aborts, it
> dumps the contents of the ring out - it deferences the string pointers
> to get the actual text. I think there was an occasion at work where I
> needed to look at the buffer in a core dump, and it was a bit clumsy,
> but certainly doable.

Ok, got mine working pretty good.  One problem though.  I catch the SIGSEGV,
so there is no core file.  Is there a way I can still get a core file as if
it was not caught (and still catch it?)

> Should work, as long as you rely on as little as possible in the dumping
> code. E.g. open the logging file with a low level 'open' call, write
> it out with no use of stdio, iostream, etc., then close it. That should
> minimize the amount of code/data you depend on, and reduce the likelihood
> of a nested SEGV.

Sound's like a good idea, but I'm going quick and dirty for now.. :)



--
Ben Greear (greear at cyberhighway.net)  http://scry.wanfear.com/~greear 
Author of ScryMUD:  scry.wanfear.com 4444        (Released under GPL)
http://scry.wanfear.com


_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev




More information about the mud-dev-archive mailing list