ReportLevel.Always is no longer writing to report

Class library usage, coding and language questions.
fwason
Posts: 26
Joined: Wed Aug 24, 2011 10:39 pm

ReportLevel.Always is no longer writing to report

Post by fwason » Tue Apr 11, 2017 3:45 pm

We've been using ReportLevel.Always to log specific information, such as the test session ID, name of test file being loaded, name of the test being run, etc. In 7.0, these logs are no longer appearing in the reports. No errors are thrown... debug steps right over without complaint, but we've lost this information. Any ideas why??

sample... worked from Ranorex 5.x through 6.1
Report.LogHtml(ReportLevel.Always,"Test Session ID:", string.Format( "<P style='color:green;margin-left:20px;'><B>{0}, Session Name: {1}</B></P>",testSession.SessionID.ToString(),testSession.TestSessionName));

not logging in 7.0

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: ReportLevel.Always is no longer writing to report

Post by ahoisl » Tue Apr 11, 2017 8:22 pm

We have not changed anything in the report API, but the report itself changed quite a bit.
My guess is that the information is in fact logged, but the report does not show it, possibly because of its different style or transformation.

Please, open the *.rxlog.data file that is generated for each report with a text editor and search for the respective string. If it is there, you know that either the transformation (*.xslt file) or the style sheet (*.css) is to blame :-)

To find out how you need to adapt the HTML you log, I would rename both the *.rxlog and *.rxlog.data files of a specific report to *.html and *.html.data and open them with your favorite browser. In the browser you can then start the developer tools (usually by pressing F12) and inspect the HTML source for the page.

Regards,
Alex
Ranorex Team

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: ReportLevel.Always is no longer writing to report

Post by ahoisl » Wed Apr 12, 2017 8:21 pm

I just got the confirmation that this is actually a bug in the reporting API - so we did screw something up there, sorry about that :?

The good news is that the bug is already fixed and scheduled for the next 7.0.1 service release. I can't tell you a date, yet, when this version will be released, but I can give you a workaround.

Instead of using ReportLevel.Always, you can create your own report level with the same semantics:
var reportLevelAlways = new ReportLevel("Always", int.MaxValue, null);
Report.Log(reportLevelAlways, "my message");
Hope this helps until the service release is available.

Regards,
Alex
Ranorex Team

fwason
Posts: 26
Joined: Wed Aug 24, 2011 10:39 pm

Re: ReportLevel.Always is no longer writing to report

Post by fwason » Thu Apr 13, 2017 7:25 pm

sounds good!

And just as an FYI, of course I opened the data file and looked for the string!! :wink: