How to configure log4j and Selenium Grid? -


When I launch a grid hub using ant, it is by default on the long console. I would like to know that there is a way in which I can change the build.xml file of Selenium Grid and include a log4j logger in it. I understand that I can specify a log file for the ant by using the --logfile option, but this would be the reason for overwriting the log file every time this grid is launched. I want to make sure the log file is automatically named so that there is access to the threshold for better maintenance. Some examples will be appreciated on how to do any help and if possible, (i am new to using log4j , that is why i demand some samples for this specific requirement I'm here).

You must specify its configuration file along with the location of the Log4j archive when launching Selenium . In the following example, I entered the log4j.hub.properties / etc / selenium directory and the log4j.hub.properties configuration file located in log4j Updated the classpath to load. Jar is located in the / usr / lib / selenium directory. I have also set up some additional log files:

  java -classpath /etc/selenium:/usr/lib/selenium/log4j.jar:/usr/lib/selenium/selenium-server - standalone.org - Dag 4J.configuration = Lodge 4JHB Properties org.openqa.grid.selenium.GridLauncher -role hub -log /var/log/selenium/hub.debug.log & gt; /var/log/selenium/hub.output.log 2 & gt; /var/log/selenium/hub.error.log & amp;   

Then to get what you are looking for, something like the following might be:

  log4j.rootLogger = ALL, file log4j Appender.file = Org.apache.log4j.FileAppender log4j.appender.file.file = / var / log / selenium / hub.log log4j.appender.file.Append = true log4j.appender.file.layout = org.apache. Log4j.PatternLayout log4j .appender.file.layout.ConversionPattern =% d {yyyy-MM-dd HH: mm: SS, SSS} <% p> & Lt;% t & gt; % M% n   

For more information about how your cellular logging is working, you might want to check it out.

Comments