Using LiveViewer to monitor a service application

Post questions here regarding the CodeSite Express edition

Using LiveViewer to monitor a service application

Postby loggerwithaxe » Fri Aug 11, 2017 9:20 am


I've been trying to get live viewing of logging to work with a service. I've installed the dispatcher as a service on the same machine as the service application. Logging to a file works fine, so the dispatcher and TCP settings are working, but when I open the Live Log Viewer, it doesn't show any log data, it stays empty.

I've seen these previous posts about logging from a service and live logging:

The second post seems to indicate that I cannot use the live viewer on the same machine with the dispatcher (2011 post), but the CodeSite help file seems to indicate that this is possible. I'm currently using the version of CodeSite that comes with Delphi (Seattle). I was wondering if things have changed since the 2011 post? Or is it an issue with using the version that comes with Delphi Seattle?

This is the code I use to initialize CodeSite logging
// CodeSite logging
Dest := TCodeSiteDestination.Create( Self );
Dest.LogFile.Active := True;
Dest.LogFile.FileName := 'AppLog.csl';
Dest.LogFile.FilePath := LogFiles.LogDir;
Dest.LogFile.MaxSize := 100000;
Dest.LogFile.MaxParts := 20;
Dest.Viewer.Active := True; //For live logging
CodeSiteManager.DefaultDestination := Dest;
CodeSite.Category := 'Main';

Posts: 2
Wed Aug 09, 2017 9:28 am

Re: Using LiveViewer to monitor a service application

Postby Raize Support » Fri Aug 11, 2017 5:06 pm

With the Dispatcher itself running as a service, messages that are sent from the Dispatcher to the Live Viewer will not work because Windows no longer allows window messages to cross between window station boundaries. File logging will continue to work.

It is easy to think that since you wish to send CodeSite messages from a service, that you need to run the Dispatcher as a service. Actually, you do not. Running the Dispatcher as a service will put the Dispatcher in the same window station as your service application, and thus the default transport method (WM_COPYDATA) will work. However, you can also continue to run the Dispatcher a regular app on your desktop. The key is that you need to tell the CodeSite loggers (in your service app) to use TCP to communicate with the Dispatcher and not WM_COPYDATA. This is what the ConnectUsingTcp method is for.

When the logger sends a CodeSite message to the Dispatcher, it will use TCP which will cross the window station and the Dispatcher running on your desktop will receive it. Then the Dispatcher will be able to send the message to the Viewer.

Hope this helps,
Raize Software Support
Raize Software
Raize Support
Posts: 603
Fri Mar 25, 2011 9:04 pm

Re: Using LiveViewer to monitor a service application

Postby loggerwithaxe » Mon Aug 14, 2017 7:35 am

Thanks Ray, this helps.

I tested it on my machine and it works as you indicate. When I run the dispatcher as a service, file logging works but live logging doesn't. When I uninstall the dispatcher as a service and run it as a regular application, the live logging works as well as file logging.

Posts: 2
Wed Aug 09, 2017 9:28 am

Return to Express Edition

Who is online

Users browsing this forum: No registered users and 1 guest