How to use Delphi 11 TMSLogging in a Windows 11 Service

Hi,

I've tried everything I can think of and I cannot get TMSLogging (using a TCP handler) to working inside a Delphi Windows Service (TService).

Is it possible?

If so, how?

Thanks much.

Frederick

Hi @Wilt_Frederick1, welcome to TMS Support Center!

Yes, it should be possible.

Did you try first with a regular VCL application? Make sure it's working in a regular VCL app first.

After that, did you try to reuse same code in the Windows Service? If yes, how? What the code you used?

Finally, after you tried that, what are the exactly problems you encountered?

Hi,

Thanks for the reply.

I started with the TMS Logging Demo project in the General folder.

That worked fine. It mentioned that there was a demo project for a TCP Client Listener that could be used with the "General" demo.

So I built that TCP Client Listener and it worked fine with the "General" demo.

So from there I tried to use the "General" demo code in my Delphi service, stripping out the handlers that I didn't want.

I was relying on the TCP Client Listener to verify the logging code in the service was working.

The service compiled fine. It started fine. I use Raize Codesite in my work and it was displaying messages indicating all was good.

The TCP Client Listener was set to "auto connect" and it seemed that it had but it was a bit hard to tell.

But nothing was displayed in the TCP Client Listener.

Following the Delphi guidelines, the Service thread created a "work" thread to do all the actually work while the Service thread focused on handling commands from the Service Controller.

In the "work" thread I had all ready placed the code for a TCP connection to a client app that is planned to monitor/control the service.

That TCP connection sent and received from a test "client" program just fine.

The Execute method of the "work" thread already creates several thread objects that are needed and they are working fine, based on basic testing.

So I put the code for the TMS logging test in the Execute method as well.

Perhaps that is wrong.

Hope you can help.

Frederick

Can you then please share your test project (service and TCP client) and provide the exact steps to reproduce the issue?