I am using log4net for creating execution logs of test cases which are created and being executed using Selenium Webdriver in C#. I was able to implement the logging functionality but I am facing an issue with the same or you can say I have a query related to this logging feature. I have seen that every web link which provides information about this logging has shown it in a way like:
driver = new ChromeDriver();
logger.Info("Browser is launched");
driver.Navigate().GoToUrl(BaseURL+"");
logger.Info("Navigate to the URL provided by the user");
driver.Manage().Window.Maximize();
logger.Info("Maximize the window");
i.e. I have to use this line 'logger.Info'
at all such places where logging is required.
Is there any way in which I can avoid using it repetitively? i.e. I use 'logger.Info'
only at one places and it creates logs for the whole test case execution automatically, means I want to avoid repeating this line again and again.
Reference links (these links shows that I have repeat this code of line):-