Page 1 of 1

Only built-in logger is being used.

Posted: 2013-06-25T22:39:02-07:00
by dlemstra
I downloaded ImageMagick-6.8.6-2-Q16-x86-static.exe and made the following changes to log.xml:

Code: Select all

<log events="All"/>
<log output="file"/>
I would expect that when I run idenity.exe a log file containing debug information will be written, but no file is being written. I checked the file log.c to see if I could identify the problem. The method LogMagickEventList calls GetLogInfo("*",exception) and that method returns the first logger:

Code: Select all

if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
    return((LogInfo *) GetValueFromLinkedList(log_list,0));
That logger will always be the built-in logger because LoadLogLists adds LogMap to the log_list before loading the file log.xml. I think the desired behavior should be:

Code: Select all

if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
    return((LogInfo *) GetLastValueInLinkedList(log_list));
Or the settings from log.xml should be inserted at the first position of log_list.

Re: Only built-in logger is being used.

Posted: 2013-06-26T14:10:29-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.6-3 Beta available by sometime tomorrow. Thanks.

Re: Only built-in logger is being used.

Posted: 2013-06-27T14:38:05-07:00
by dlemstra
Thanks for the quick reply and fix but with the latest version of log.c I can create a StackOverflowException when I add the following to identify.c:

Code: Select all

utf8=NTArgvToUTF8(argc,argv);
SetLogEventMask("All");
And log.xml file contains:

Code: Select all

<log events="All"/>
This is happening because 'AppendValueToLinkedList' does the following:

Code: Select all

  list_info->debug=IsEventLogging();
  if (list_info->debug != MagickFalse)
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
When the xml file has been loaded the result of the method will be 'MagickTrue' and the next line will write something to the log. This will call 'IsEventLogging' that does the following:

Code: Select all

  if ((log_list == (LinkedListInfo *) NULL) ||
      (IsLinkedListEmpty(log_list) != MagickFalse))
    return(MagickFalse);
And in IsLinkedListEmpty something will be written to the log again (and 'IsEventLogging' will be called again....):

Code: Select all

  if (list_info->debug != MagickFalse)
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
It is probably a good idea to disable logging for 'log_list'.

Re: Only built-in logger is being used.

Posted: 2013-06-27T16:23:30-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.6-3 Beta available by sometime tomorrow. Thanks.