Using Logog for crash analysis

10 views
Skip to first unread message

Joseph Shtok

unread,
Jul 25, 2017, 6:05:44 AM7/25/17
to Logog
Dear John,

I would like to use the Logog in a fashoin that would permit presering (almost) all of the log messages in the case the code crashes. For example, I can keep a buffer and dump it to file once in 500 ms.

I have tried the following code (borrowed in parts from the unitest)

LOGOG_INITIALIZE();
{

LogFile logFile( "log.txt" );
LogBuffer logBuffer( &logFile );
logBuffer.SetNullTerminatesStrings( false );
logFile.UnsubscribeToMultiple( AllFilters() );

Formatter *pFormatter = &GetDefaultFormatter();
pFormatter->SetShowTimeOfDay( true );

ERR( _LG( "This is an error") );
DBUG( _LG( "This is debugging info ",) );
logBuffer.Dump();

WARN("a WARNING MESSAGE WITH number %.3f", 0.43543);
                logBuffer.Dump();

}
LOGOG_SHUTDOWN();

I would expect the logBuffer.Dump(); to save the first two errors to the file, but the file only appears to get filled with content when the whole program finishes. If the program crashes after a the first .Dump(), nothing is saved (I use 'break' in Debug mode to simulate the crash). What happens when the .Dump() is called?

Thank you,
Joseph Shtok

John Byrd

unread,
Jul 26, 2017, 2:58:06 AM7/26/17
to lo...@googlegroups.com
Set the bEnableOutputBuffering parameter on the logFile, when creating it, to false, and Bob's your uncle.

    LogFile logFile("log.txt", false);

I'm updating the test suite and the documentation accordingly.

jwb



--
You received this message because you are subscribed to the Google Groups "Logog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to logog+unsubscribe@googlegroups.com.
To post to this group, send email to lo...@googlegroups.com.
Visit this group at https://groups.google.com/group/logog.
For more options, visit https://groups.google.com/d/optout.



--
---

John Byrd
Gigantic Software
2321 E 4th Street
Suite C #429
Santa Ana, CA  92705-3862
http://www.giganticsoftware.com
T: (949) 892-3526 F: (206) 309-0850
Reply all
Reply to author
Forward
0 new messages