Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Loggin Connections


#1

Can the connections be changed at anytime? I know I can create multiple sessions but I don’t really want or need that. Right now I have a basic file log going but may want to turn on/off remote TCP logging after the program has already started. Is this doable?


#2

Hello,

Thanks for your posting. When you add multiple connections to one SmartInspect instance (Si.Connections), you cannot turn off just one connection but only all of them. If you need to turn off/on connections independently from each other at runtime, I would recommend using two SmartInspect instances, one for the file connection and another one for the TCP connection. You can then use their Enabled property to turn off/one logging for just one specific connection.

I hope this helps. Just let me know in case anything is unclear or in case you have any further questions.

Regards,
Tobias


#3

That is what I thought I would have to do. Right now I am being lazy as I don’t really want or feel that I need to invest in a wrapper layer around SmartInspect but that sounds like what I am going to have to do to be able to log everything to more than one connection and beable to turn on/off one or more of the connections.


#4

Another option which has nearly the same effect as turning off/on individual connections would be to re-assign the Connections property when you need to change the connections, e.g.:

SiAuto.Si.Connections = ‘file(), tcp()’;

// Then later when you don’t the TCP connection anymore:
SiAuto.Si.Connections = ‘file()’;

I say nearly the same effect, because this would effectively also disconnect/reconnect the file connection temporarily, and depending on the connection options you use, also reset connection buffers like the backlog feature, for example.

I hope this helps,
Tobias