exilon/QuickLogger

GlobalLogFileProvider Only logging header

AdriaanBoshoff opened this issue · 1 comments

In my previous issue I thought that it was an issue with the windows service however it seems like GlobalLogFileProvider is not working at all. I only seem to get a header output.

IDE: Delphi 10.4.1

CODE:

unit ufrmMain;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes,
  System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, Quick.Logger,
  Quick.Logger.Provider.Files, FMX.Controls.Presentation, FMX.StdCtrls;

type
  TForm2 = class(TForm)
    btn1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.fmx}

procedure TForm2.btn1Click(Sender: TObject);
begin
  Log('test 2', etInfo);
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
  with GlobalLogFileProvider do
  begin
    FileName := 'C:\temp\Logger.log';
    DailyRotate := True;
    MaxFileSizeInMB := 20;
    LogLevel := LOG_ALL;
    Enabled := True;
  end;

  Log('test', etInfo);
end;

end.

Logger Output:

----------------------------------------------------------------------
Application : LoggerTest 1.0
Path        : C:\Users\aaboshoff\Documents\Embarcadero\Studio\Projects\LoggerTest\Win32\Debug\
CPU cores   : 12
OS version  : Windows 10 (Version 10.0, Build 22000, 64-bit Edition)
Host        : ADRIAAN-LAPTOP
Username    : aaboshoff
Started     : 14-07-2022 11:38:29 
Debug mode  : On
----------------------------------------------------------------------
----------------------------------------------------------------------
Application : LoggerTest 1.0
Path        : C:\Users\aaboshoff\Documents\Embarcadero\Studio\Projects\LoggerTest\Win32\Debug\
CPU cores   : 12
OS version  : Windows 10 (Version 10.0, Build 22000, 64-bit Edition)
Host        : ADRIAAN-LAPTOP
Username    : aaboshoff
Started     : 14-07-2022 11:41:30 
Debug mode  : On
----------------------------------------------------------------------

I have provided a test application.
LoggerTest.zip

I forgot to add the log provider. Stupid me.

Logger.Providers.Add(GlobalLogFileProvider);