Event logging

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Event logging

Post by el_supremo »

I'm using Windows XP and IM 6.3.0.
I want MagickWand to create an event log to a file. At the beginning of my code I have:

Code: Select all

MagickWandGenesis();
(void) SetLogEventMask("all");
if(IsEventLogging())
	MessageBox(NULL,"LOG ON", "Note", MB_OK);
else
	MessageBox(NULL,"LOG OFF", "Note", MB_OK);
which indicates that logging is on. At the end I have:

Code: Select all

GetExceptionInfo(&exception);
logf = fopen("log.txt","wt");
if(ListLogInfo(logf,&exception))
	MessageBox(NULL,"LOGGED", "Note", MB_OK);
else
	MessageBox(NULL,"LOGGING FAILED", "Note", MB_OK);
fclose(logf);
MagickWandTerminus();
which crashes in ListLogInfo.
How do I set up a C MagickWand program so that it logs all events to a file?

Thanks
Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

To send logging to a file, edit log.xml and change the output tag from console to file.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

Thanks for the speedy response.
For the info of anyone else, editing the output tag in coders/log.xml and including the statement "SetLogEventMask("all");" in the program is all that's required.

Once I'm done debugging I'll have to remember to go back to the log.xml file and put it back the way it was. It would be nice if a debugging program could override the output tag without actually changing the log.xml file - a SetLogOutputFile function perhaps.

Pete
Post Reply