How to Prevent Superfluous Connection Logging in TCP Interfaces

You might have encountered this and not known how to prevent it, or perhaps not even noticed it...

But when you have TCP Interoperability Production business components (e.g. an HL7 business service) you probably have (depending on your StayConnected setting) many entries in the Event Log of Info type. Each entry would log a connection or disconnection.

For example:

And:

This information can indeed be handy for debugging for example or keeping an eye on how the connections are working, but on an ongoing basis, especially if StayConnected is not permanent (-1) then this could generate a very large amount of entries.

If you would like to avoid this kind of logging (and actually turn the entries into configurable Trace events, instead of the Info ones), you can do this by performing the steps described below.

Some background first -

The code in the TCP Adapter, responsible for this logging, is conditional (to log an INFO kind of event or a TRACE one) - depending on a property in the Adapter called %logconnections.

The default value for this property is 1 (one), i.e. to log these connect and disconnect event (as INFO events).

At the startup of the Inbound or Outbound TCP Adapter (in the OnInit() method) the Adapter checks for a value of a Class Parameter in the host's class (e.g. the Business Service or Business Operation class). The name of this Class Parameter is LOGCONNECTIONS.

For example:

If 0=..BusinessHost.%GetParameter("LOGCONNECTIONS") Set ..%logConnections=0


So in order to prevent the events to be logged (as INFO events) you can simply create a Class Parameter called LOGCONNECTIONS in your business host class and set it's value to 0 (zero).

Assuming for example you have an HL7 inbound Business Service the steps would be -

  1. Create a Class that extends EnsLib.HL7.Service.TCPService
  2. Add a Class Parameter called LOGCONNECTIONS with a value of 0
  3. Change your Business Service's class in your Production to be your newly created class.

Here's a sample class per above -

Class Test.BS.HL7.TCPService Extends EnsLib.HL7.Service.TCPService
{

  Parameter LOGCONNECTIONS As %Boolean = 0;

}

And in my Production's Business Service I have:

Now connections will not be logged at all.

Or, if you need to see the logs for debugging or any other purpose, turn on tracing for your component and you will see now Trace events (instead of the Info ones we had before).

For example:

And:

 

Hopefully this should help you keep your Event Log cleaner and at a better size.