exilon/QuickLogger

Adding a QuickLogger to the USES section of the DLL causes to application to hang

charactell-public opened this issue ยท 5 comments

Delphi 10.4

I am trying to add a file logger to my simple DLL application:

uses
  System.SysUtils,
  System.Classes,
{$IFDEF VER340}
  Quick.Logger,
  Quick.Logger.Provider.Files
{$ENDIF}
    ;

function FieldOfExperiments(): longint; stdcall;
begin
  Result := 0;
  try
  except
    on E: Exception do
  end;
end;

exports
    FieldOfExperiments;
{$R *.res}
begin
end.

When the main application attempts to load the DLL, the application gets unresponsive and hangs:

image

Any ideas? Did I miss something?

Thanks
Vitaly

QuickLogger can be called from a DLL without problems, we do it from .NET for example. Your code seems fair, but you need to post your DLL client code. Where are you calling your DLL? What language are you using to load and call your DLL??

Hello all,

I'm new here and landed here searching a solution for my problem.
I use the quick library and logger already in standard VCL programs with no problems at all.

Now my colleague and I are building a plugin for Outlook and Word.
For this we are using the components of add-in express.
So we're building a COM plugin for local instance of office.
This is a dll too.
The problem is when closing Word, It hangs.
In outlook this isn't a problem, so just word.

Debugging it I found the point it stops responding.
In Quick,Logger.pas at line 1315:

  fThreadProviderLog.Terminate;
  fThreadProviderLog.WaitFor;
  fThreadProviderLog.Free;
  //if Assigned(fProviders) then fProviders.Free;
  FreeAndNil( fProviders );
  fCustomTags := nil;
  FreeAndNil( fLogQueue ); 

The .WaitFor is never returning...
I also had a breakpoint in the thread that has to stop, the while loop is ended correctly.
So it seems the thread is terminatied after the calling of .Terminate method.

I don't know this problem is the same as described here, but hopefully it gives a clue.
Or do I have to open a new issue?

Kind regards,

Jan

Hello,
i got similar issue.
I create empty Apache dynamic link module in Delphi 10.4.2, build it into Ubuntu Linux, configure Apache to load it and all works fine.
But when i just add Quick.Logger into uses section - Apache fail to start.
Console application with Quick.Logger works fine on same PC, so i can't even debug what's a problem.

Any suggestions?

I removed automatic creation of Logger from initialization section of Quick.Logger and Apache module get back to work.
Seems like Apache works in some specific mode when try to load external modules in initialization. So issue is somehow related to work in this mode.
Manual creating of Logger instance in OnCreate event of TWebModule class can bypass this problem, but I'm not sure that this is right way of solving issue.
Anyway adding some {$IFDEF} into initialization section to prevent default creation can be useful in my opinion.