Serilog | Logging in Automation Framework | Selenium C#

Published: 21 November 2021
on channel: Maximum Automation
2,761
22

In this video we will discus about logging in automation framework. There are many number of logging libraries available, which can be use in our framework like Nlog, log4net and serilog. But in our framework we are going to use Serilog.

Different Log events we can use in Serilog are as below:
ERROR
WARN
INFO
DEBUG
VERBOSE

If we want to use Serilog in our framework, then packages to be installed are
Serilog and Serilog.Sinks.File.
Then we can write below code to initialize or configure the serilog.
LoggingLevelSwitch levelswitch = new LoggingLevelSwitch(LogEventLevel.Debug);
Log.Logger = new LoggerConfiguration()
.MinimumLevel.ControlledBy(levelswitch)
.WriteTo.File( "path of report", outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} | {Level:u3} | {Message}{NewLine} ", rollingInterval: RollingInterval.Day).CreateLogger();


Based on the minimum log event type, provided in the configuration we will get the log events in the log file.


Please comment in case of any queries.


Also please see my other videos as well.

Selenium with C# - Klov Report :    • Selenium with C# | Klov Report Server  

Selenium with C# - Extent Report :    • Selenium with C# | Extent Report  

Selenium with C# - Create Project to automate test (Selenium + Specflow ) :    • Video  

Selenium with C# - Parallel Execution and Screenshot :    • Video  

Selenium with C# - All about feature files :    • Video  

Selenium with C# - Specflow - External Bindings :    • Selenium C# | Specflow | External Bin...  

Selenium with C# Working with Excel - Part 1 :    • Video  

Selenium C# - Visual Studio Code :    • Selenium C# | Visual Studio Code | No...  


Watch video Serilog | Logging in Automation Framework | Selenium C# online without registration, duration hours minute second in high quality. This video was added by user Maximum Automation 21 November 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,761 once and liked it 22 people.