Logging of IP Address and Request

I am logging the client request of a soap service using TROIndyHTTPServer.OnReadFromStream, and logging the client IP address via TRORemoteDataModule.GetDispatchInfo. These are two different events, and from what I understand could be happening in two different threads when the server is under load (my understanding is that TRORemoteDataModule is created in seperate thread per request).

How can I obtain the client request string from the TRORemoteDatamodule in a thread-safe manner in order to do something like:
Log(vClientIP, vRequestStr);

I see no way to reference the main datamodule that contains the ROServer from within the _IMPL class.

Thank you.

Hi,

check the MegaDemo sample.
it contains the Log method that allows to perform logging in a thread-safe manner.

1 Like

Thanks Evgeny, but my question really was - “How do I pass the request string from the main form to an instance of the TRORemoteDataModule”? The creation of this datamodule does not seem to occur in an event that I can intercept. Ideally (I think), I would override the contructor of the datamodule to accept this string. Then within the GetDispatchInfo event, I can combine the ip address with the request string and make a single log entry.

Hi,

you may have Logger class in separate module that can be linked to server datamodule and _impl.

you can test aTransport for IROHTTPTransport. this interface contains required info


EDIT: check this snippet for details.