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

Logging different Sessions to different connections


#1

I need to have different sessions write to one or more targets (file, txt, tcp) etc depending on what they are logging.

I am not seeing how to do this and i hope i am just missing something as this seems like a critical thing to be able to do.

For example, i want a session called siInvite to log to InviteLog.txt, a session called siDebug to log to debugLog.sil, and another session called siMain to log to Main.txt, tcp and main.sil

How can I achieve this? i am currently using log4net and it supports different targets based on the logger used.


#2

Figured it out. i was trying to use siAuto =)

[code]dim Test as SmartInspect
dim siFoo as session

test = new SmartInspect(“TEST”)
Test.Connections = "file(append=true, filename=c:\fooLog.sil, rotate=daily), tcp(host=localhost), text(filename=c:\FooLog.txt, rotate=daily, indent=true)"
test.Enabled = True

siFoo = new Session(Test,“Foo”)

siFoo.Color = color.Red
test.AddSession(siFoo)

siFoo.Active = True

Sifoo.LogMessage(“Some message”)[/code]


#3

Hello Eric,

Thanks for your posting. If you want to use different log targets (connections) for different sessions, you would need to create multiple SmartInspect instances, set the connections and then create the sessions accordingly.

E.g. when you want to have session A and B log to a file and session C log to the Console via TCP/IP, you could create two SmartInspect instances, configure the file and TCP connections, respectively, and then add the session A and B to the first SmartInspect instance and session C to the second SmartInspect instance.

I hope this helps,
Tobias