Sunday, March 10, 2019

Using text logging library Log4Net in automated tests



https://www.udemy.com/windows-service-programming/?couponCode=HALF

https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/?couponCode=HALF

https://www.udemy.com/udpsocketprogramming/?couponCode=HALFPRICE

https://www.udemy.com/course/windows-ui-automation-on-azure-devops-build-pipelines/?referralCode=31F4FCC272434D3B1C3C

It is possible to add text logging functionality to our Windows Service or test automation scripts using Log4Net. You can also add Log4J-based test logging to your test automation scripts if you're working on the Java platform. 

Why do we need text logging?
We need it because it allows us to learn about the internal state of our test automation scripts or Windows Service. The applications which don't have a console available to print information can write a text log which can then be used to trace their state for debugging. 
Writing everything to the system log is not viable. That's why putting information in a text file is a common practice. So that you can know what flow leads to an error or a service crash
I'm going to introduce you to the Log4Net logging library
Apache Log4Net is a free & open-source logging library. It is used to generate rolling text log files
Rolling means that the library is responsible for rolling the log files
In other words, creating new files when the file size exceeds a set threshold or the date is changed
Log4Net can be used to write information to various logging targets, including network and databases
Using a logging library means we're not reinventing the wheel.
It helps us to change what gets written to the log file based on specific configuration values
Now that you know why we're using a logging library, you can go to Visual Studio and continue coding.

No comments:

Post a Comment

Feel free to talk back...