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

Session Color Does'nt Work When Using Configuration File


#1

Hi,
I already defined several custom sessions on configuration file with the different color for each session. But when i call from c# code, it seem not work. the session doesn’t display the color i already defined on configuration file.

Below is my configuration file :

AppName = ProjectCosting 0.96
;Connections = file(filename=“ProjectCosting.sil”, maxsize=“25600”, rotate=“daily”, encrypt=“true”, key=“thepowerismine”, buffer=“51200”, ;caption=“ProjectCostingConn”, reconnect=“true”, reconnect.interval=“5”)
Connections = tcp()
DefaultLevel = Message
Enabled = True
Level = Message
Session.BusinessRule.Active = True
Session.BusinessRule.Color = 0xFF8080
Session.BusinessRule.Level = Debug
Session.BgJob.Active = True
Session.BgJob.Color = 0x804000
Session.BgJob.Level = Debug
Session.SAPProxy.Active = True
Session.SAPProxy.Color = 0x808000
Session.SAPProxy.Level = Debug

and the c# code is :

SmartInspect si = new SmartInspect(“Object”);
si.Error += new ErrorEventHandler(EventHandler);
si.LoadConfiguration(“ProjectCosting.sic”);
Session sesBgJob = si.AddSession(“BgJob”);
sesBgJob.ClearAll();
sesBgJob.EnterProcess(“ProjectCosting 0.96 Application is started”);
sesBgJob.LogMessage(“Loop Posting Request ID”);
SiAuto.Main.LeaveProcess(“ProjectCosting 0.96 Application is finished”);

what’s wrong i’ve done?


#2

Hi,

I’m not really sure but under delphi there is an problem by parsing the configuration file. The parsing process looks for session with an small s at the beginning.
If you change the configuration file manually to small s for session it will work.


#3

Hi Stephan Rabich,

That’s just working, thank you very much. :slight_smile:
I thinks this is the bug of configuration generator.

But there is one more question about declared session.
can i use declared sessions on configuration file without redeclaring variable on C#/Delphi/etc first using “AddSession”? Maybe i can use it directly using syntax SmartInspect.GetSession(SESSION_NAME).LogMessage(MESSAGE) or something like that.

Because when i inspecting the SmartInspect variable on runtime, the session i’ve been declared on the configuration file have been created, can i use it directly?

thanks for all


#4

Hello Fathur,

As Stephan posted, there’s a small bug in the session loading when a session entry uses a capital ‘S’ in the configuration file. That bug is already fixed in an internal build and will be released soon.

[quote]But there is one more question about declared session.
can i use declared sessions on configuration file without redeclaring variable on C#/Delphi/etc first using “AddSession”?[/quote]

You need to call AddSession(SESSION_NAME, true) once to add the session (if you have previously called the LoadConfiguration method, the session will be automatically configured with the settings of the configuration file). The second parameter instructs the SmartInspect to store the session for later use. If you pass true (false is the default), you can then use the following syntax to access the created session later:


#5

Hi Tobias,

Thanks for all.