Recent

Author Topic: MultiLog: Is this logger dead?  (Read 9113 times)

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
MultiLog: Is this logger dead?
« on: August 25, 2017, 12:28:26 am »
Downloaded, installed, and compiled multilog (win10 64bit Laz 1.8 RC4).
Fired the MultiLog viewer then ran the demo program inside Laz and nothing showed up in the viewer.
Am I missing a step here? The Wiki has a link for demos but the link is dead.
Could anyone describe what needs to be done to use MultiLog?

Thanks.

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: MultiLog: Is this logger dead?
« Reply #1 on: August 25, 2017, 12:33:42 am »
I can't really answer your question about MultiLog. I know about it, but never used it before. I can help by suggesting another option. The tiOPF (http://tiopf.sourceforge.net) project includes excellent logging support that can be used independently with other projects that don't actually use tiOPF. Take a look at the tiLog, tiLogToConsole, tiLogToGUI units. If you want to try and and need further help, you are welcome to ask in the tiOPF support newsgroup (http://tiopf.sourceforge.net/Support.shtml).
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: MultiLog: Is this logger dead?
« Reply #2 on: August 25, 2017, 12:34:39 am »
in a unit inside your application any unit will do as long as it get used in this case use the unit that has the mainform.
Code: Pascal  [Select][+][-]
  1. uses
  2.   Classes, SysUtils
  3.   {$IFDEF MULTILOG}, sharedlogger, ipcchannel, filechannel, multilog {$ENDIF};
  4. ...
  5. ...
  6. {$IFDEF MULTILOG}
  7. initialization
  8.   Logger.Channels.add(TIPCChannel.Create);
  9. {$ENDIF}
  10. end.
  11.  
I think that is it. At least I do not remember doing anything else special. Make sure that the viewer is open before you run your application though.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
Re: MultiLog: Is this logger dead?
« Reply #3 on: August 25, 2017, 12:41:07 am »
in a unit inside your application any unit will do as long as it get used in this case use the unit that has the mainform.
Code: Pascal  [Select][+][-]
  1. uses
  2.   Classes, SysUtils
  3.   {$IFDEF MULTILOG}, sharedlogger, ipcchannel, filechannel, multilog {$ENDIF};
  4. ...
  5. ...
  6. {$IFDEF MULTILOG}
  7. initialization
  8.   Logger.Channels.add(TIPCChannel.Create);
  9. {$ENDIF}
  10. end.
  11.  
I think that is it. At least I do not remember doing anything else special. Make sure that the viewer is open before you run your application though.

Thanks Taaz. Actually, that line exists in the TestMultiLog project. What's interesting is that when I tried to compile it, it could not find the SharedLogger unit. It's not part of the MultiLog base code and I can't find it anywhere. I commented it out and the code ran without a hitch but perhaps there is required code in that SharedLogger unit?

Also, with fpc, MultiLog is using the SimpleClientIPC and I've read on another thread that SimpleClientIPC is having issues with Laz 1.8 on Win 64 bit. I'm wondering if this factors into this equation?

I ran the MultiLog Viewer inside Laz and set a breakpoint on the listening method and then ran the TestMultilog project. It created the logging file without a problem but the breakpoint never fired which leads me to suspect the issue is an IPC inter-communication. I also checked that both Viewer and the Test project are talking to the same server (IPC_DEFAULT_SERVER_NAME = 'ipc_log_server'). Finally, I checked to make sure that Norton is not blocking it from a firewall standpoint but norton's log does not show any attempt to communicate at that level.

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
Re: MultiLog: Is this logger dead?
« Reply #4 on: August 25, 2017, 12:41:36 am »
I can't really answer your question about MultiLog. I know about it, but never used it before. I can help by suggesting another option. The tiOPF (http://tiopf.sourceforge.net) project includes excellent logging support that can be used independently with other projects that don't actually use tiOPF. Take a look at the tiLog, tiLogToConsole, tiLogToGUI units. If you want to try and and need further help, you are welcome to ask in the tiOPF support newsgroup (http://tiopf.sourceforge.net/Support.shtml).

Graeme, thanks!

I'll definitely take a look!

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: MultiLog: Is this logger dead?
« Reply #5 on: August 25, 2017, 12:52:22 am »
Thanks Taaz. Actually, that line exists in the TestMultiLog project. What's interesting is that when I tried to compile it, it could not find the SharedLogger unit. It's not part of the MultiLog base code and I can't find it anywhere. I commented it out and the code ran without a hitch but perhaps there is required code in that SharedLogger unit?

Also, with fpc, MultiLog is using the SimpleClientIPC and I've read on another thread that SimpleClientIPC is having issues with Laz 1.8 on Win 64 bit. I'm wondering if this factors into this equation?

I ran the MultiLog Viewer inside Laz and set a breakpoint on the listening method and then ran the TestMultilog project. It created the logging file without a problem but the breakpoint never fired which leads me to suspect the issue is an IPC inter-communication. I also checked that both Viewer and the Test project are talking to the same server (IPC_DEFAULT_SERVER_NAME = 'ipc_log_server'). Finally, I checked to make sure that Norton is not blocking it from a firewall standpoint but norton's log does not show any attempt to communicate at that level.
sharedloger is in my multilog installation directory it is a simple little unit
Code: Pascal  [Select][+][-]
  1. unit sharedlogger;
  2.  
  3. {$ifdef fpc}
  4. {$mode objfpc}{$H+}
  5. {$endif}
  6.  
  7. interface
  8.  
  9. uses
  10.   multilog;
  11.  
  12. const
  13.   //lc stands for LogClass
  14.   //it's possible to define the constants to suit any need
  15.   lcAll = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
  16.   lcDebug = 0;
  17.   lcError = 1;
  18.   lcInfo = 2;
  19.   lcWarning = 3;
  20.  
  21.   lcEvents = 4;
  22.  
  23. var
  24.   Logger: TLogger;
  25.  
  26. implementation
  27.  
  28. initialization
  29.   Logger:=TLogger.Create;
  30. finalization
  31.   Logger.Free;
  32. end.
  33.  
but if that is not there for you there might be other problems. For that reason I'm attaching my installation dir of multilog from my lazarus 1.4.4 installation.
I'll try to install it on 1.6.4 and see if there is any differences. As for the win64 problem this is the first time I hear about it. I'm running most of my 32bit applications in a windows7 64bit and multilogger has worked so far maybe its a 64bit application problem? I'll have to install the cross compiler to 64bit at some point and test it.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
Re: MultiLog: Is this logger dead?
« Reply #6 on: August 25, 2017, 02:53:39 am »
Taazz,

I've tested it with your code and I get the same result: nothing shows inside the viewer. I tried it with the simple viewer and the viewer. No difference.

The log to disk works fine. It's the ipc portion that's broken.

By the way, here's the link to that other thread where they're discussing ipc failures. The initial messages date back to 2015 but the latest ones are 2017 and fairly recent.

http://forum.lazarus.freepascal.org/index.php/topic,30135.0.html
« Last Edit: August 25, 2017, 02:56:05 am by EganSolo »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: MultiLog: Is this logger dead?
« Reply #7 on: August 25, 2017, 03:14:08 am »
Taazz,

I've tested it with your code and I get the same result: nothing shows inside the viewer. I tried it with the simple viewer and the viewer. No difference.

The log to disk works fine. It's the ipc portion that's broken.

By the way, here's the link to that other thread where they're discussing ipc failures. The initial messages date back to 2015 but the latest ones are 2017 and fairly recent.

http://forum.lazarus.freepascal.org/index.php/topic,30135.0.html
https://s29.postimg.org/yhgkrexiv/multilog.gif here is a small gif showing the multilog demo, included in the rar I attached in my last post, running on windows 7 64bit, from lazarus 1.4.4. You are running the same test and fails?

In the thread posted it looks like its an lcl bug on newer versions not a windows bug. I'll test it tomorrow on 1.6.4 and see what I can find out. Now I need some sleep is 5AM and in 2 hours I have to get up for work.
« Last Edit: August 25, 2017, 03:22:57 am by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
Re: MultiLog: Is this logger dead?
« Reply #8 on: August 25, 2017, 03:26:27 am »
I'm running the SimpleViewer project from the demo folder:
Code: Pascal  [Select][+][-]
  1. program testmultilog;
  2.  
  3. {$ifdef fpc}
  4. {$mode objfpc}{$H+}
  5. {$endif}
  6.  
  7. uses
  8.   Classes, SysUtils,
  9.   filechannel, ipcchannel, sharedlogger;
  10.  
  11. type
  12.  
  13.   { TMyObject }
  14.  
  15.   TMyObject = class(TComponent)
  16.   private
  17.     FId: Integer;
  18.   published
  19.     property Id: Integer read FId write FId;
  20.   end;
  21.  
  22. var
  23.   AList: TStrings;
  24.   Obj: TMyObject;
  25.  
  26. begin
  27.   AList:=TStringList.Create;
  28.   with Logger do
  29.   begin
  30.     Channels.Add(TFileChannel.Create('test.log'));
  31.     Channels.Add(TIPCChannel.Create);
  32.     ActiveClasses:=[0,1];
  33.     DefaultClasses:= [1];
  34.     IncCounter('Counter1');
  35.     Watch('AStrWatch','XXXX');
  36.     Send('An empty StringList',AList);
  37.     IncCounter('CounteR1');
  38.     Watch('AIntWatch',123);
  39.     Send('A Text Message');
  40.     IncCounter('CounTER1');
  41.     Send('Another Text Message');
  42.     with AList do
  43.     begin
  44.       Add('aaaaaa');
  45.       Add('bbbbbb');
  46.       Add('cccccc');
  47.     end;
  48.     DecCounter('Counter1');
  49.     Watch('AIntWatch',321);
  50.     SendError('A Error Message');
  51.     ResetCounter('Counter1');
  52.     Watch('ASTRWatch','YYYY');
  53.  
  54.     Obj := TMyObject.Create(nil);
  55.     Obj.Name := 'The_Obj_Name';
  56.     Obj.Id := 2;
  57.     Send('An Object/Component', Obj);
  58.     Obj.Destroy;
  59.  
  60.     EnterMethod('DoIt');
  61.     Send('AText inside DoIt');
  62.     SendWarning('A Warning');
  63.     Send('A String','sadjfgadsfbmsandfb');
  64.     Send('AInteger',4957);
  65.     Send('A Boolean',True);
  66.     SendCallStack('A CallStack example');
  67.     ExitMethod('DoIt');
  68.     Send('A StringList',AList);
  69.     DefaultClasses:=[2];
  70.     Send('This Text Should NOT be logged');
  71.     Send([1],'This Text Should be logged');
  72.     ActiveClasses:=[0];
  73.     Send([1],'But This Text Should NOT');
  74.   end;
  75.   AList.Destroy;
  76. end.
  77.  

The viewer is the same. I don't know if your test versus this one makes a difference? But see also the issue I'm having with creating a simple client /server app with SimpleIPC here: https://forum.lazarus.freepascal.org/index.php/topic,38053.0.html . I'm wondering if there's a relation there?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: MultiLog: Is this logger dead?
« Reply #9 on: August 25, 2017, 03:38:55 am »
The viewer is the same. I don't know if your test versus this one makes a difference?
It is not my test it is the demo application included in the multilog installation. lets use this one as the test platform to avoid any user error. It should be in the demos\all folder of the rar.
But see also the issue I'm having with creating a simple client /server app with SimpleIPC here: https://forum.lazarus.freepascal.org/index.php/topic,38053.0.html . I'm wondering if there's a relation there?
there might be I'm not sure. I didn't had the need to go looking around of what it uses yet.

« Last Edit: August 25, 2017, 03:41:02 am by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

EganSolo

  • Sr. Member
  • ****
  • Posts: 290
Re: MultiLog: Is this logger dead?
« Reply #10 on: August 25, 2017, 05:15:40 am »
Yeah, no: Ran the same test as you did and the outer viewer is not reacting to anything being sent by the client app.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: MultiLog: Is this logger dead?
« Reply #11 on: August 25, 2017, 01:26:24 pm »
Yeah, no: Ran the same test as you did and the outer viewer is not reacting to anything being sent by the client app.
Ok I'll install the control in 1.6.4 and test later today. Hopefully it is something easy or solvable with a simple copy of a file.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • Paul Rowntree
Re: MultiLog: Is this logger dead?
« Reply #12 on: August 18, 2018, 03:27:01 am »
Yeah, no: Ran the same test as you did and the outer viewer is not reacting to anything being sent by the client app.
If anyone is still interested, the trouble is that the form's ApplicationIdle() routine is never being executed, and this is where the simpleIPCServer.Peek(1,true) is tested.If you drop a timer on the window that calls ApplicationIdle() every 100 ms or so, it starts to pick up the incoming messages, albeit slowly.
I'm running L 1.8.4, but it behaved as you said until forcing the execution of the Peek() routine.
Cheers!


Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • Paul Rowntree
Re: MultiLog: Is this logger dead?
« Reply #13 on: August 18, 2018, 03:57:51 am »
Yeah, no: Ran the same test as you did and the outer viewer is not reacting to anything being sent by the client app.
If anyone is still interested, the trouble is that the form's ApplicationIdle() routine is never being executed, and this is where the simpleIPCServer.Peek(1,true) is tested.If you drop a timer on the window that calls ApplicationIdle() every 100 ms or so, it starts to pick up the incoming messages, albeit slowly.
I'm running L 1.8.4, but it behaved as you said until forcing the execution of the Peek() routine.
There doesn't seem to be any online docs for ApplicationIdle.  Delphi pages say setting Done to false should make it work as expected, but no effect in Lazarus.  here is my patch

procedure TfrmMain.ApplicationIdle(Sender: TObject; var Done: Boolean);
var
  B : boolean;
begin
  B := true;
  repeat
    B := FIPCServer.PeekMessage(1,True);
  until not B;

  Done := false;
end;       
Cheers!
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

 

TinyPortal © 2005-2018