Question
CIGNA Health Solutions India
IN
Last activity: 23 Jun 2021 10:42 EDT
How to Write Logs to OutPut Panel In Studio
Hi Team,
I have would like to Write Custom Logs to my OutPut Panel During my Testing, please see below scenario
I have 5 Stages in Automation and i will be testing in this way
1) Login Stage:
- Log should Appear in OutPut panel as --Login Started
- Log should Appear in OutPut panel as --Login Successful
2) Update fields in Home Page
- Log should Appear in OutPut panel as --Fields Update Started
- Log should Appear in OutPut panel as --Fields Update Successful
And so on, can you please help me to understand How to write these type of logs to Studio OutPut Panel. Instead of Log.txt file.
@praneetv9588 In your RuntimeConfig.xml, you would enable the Output Window Publisher.
<publisher mode="on" trace_mode="on" exception_mode="on" assembly="OpenSpan" type="OpenSpan.Diagnostics.Publishers.OutputWindowPublisher" InnerXml=",," />
In your automation, add a DiagnosticsLog component from the Advanced section of the Toolbox. Set the "Type" property of this component to the level of logging you wish the messages to be captured as. Make sure that your "Automation" log category is set to at least that level. In the example below, I have it set to a 1 for Error (2 is Debug, 3 is Info and 4 is Verbose). Where you want a message written in your automation, call the Log method of the DiagnosticsLog component and enter whatever message you wish to write.
<Category name="Automation" logLevel="1" />
When you start Runtime, right-click the tray icon and select "View Output window". Your messages will appear there.