Only built-in logger is being used.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Only built-in logger is being used.

Post 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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Only built-in logger is being used.

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Only built-in logger is being used.

Post 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'.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Only built-in logger is being used.

Post 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.
Post Reply