How To Enable Selenium Grid Logs

1,283 views
Skip to first unread message

Ajay Verma

unread,
Nov 2, 2018, 8:03:42 AM11/2/18
to Selenium Users
Could anyone please let me know, How we can enable logs in selenium grid i.e. I am having 8 node grid, i want logs for each node, Any leads would be appreciable. 

⇜Krishnan Mahadevan⇝

unread,
Nov 2, 2018, 11:06:38 PM11/2/18
to seleniu...@googlegroups.com
Selenium uses java.utils.logging.

So you basically refer to a logging tutorial such as this one http://tutorials.jenkov.com/java-logging/overview.html and create a logging configuration file and then pass it on to the JVM when you start the node. That should turn on the logs on the node.

Is that what you are looking for?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ http://rationaleemotions.wordpress.com/


On Fri, Nov 2, 2018 at 5:33 PM Ajay Verma <ajay...@gmail.com> wrote:
Could anyone please let me know, How we can enable logs in selenium grid i.e. I am having 8 node grid, i want logs for each node, Any leads would be appreciable. 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8d67b04e-07df-46fc-8c66-fabded0c2a03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ajay Verma

unread,
Nov 5, 2018, 4:57:48 AM11/5/18
to seleniu...@googlegroups.com
Hi  Krishnan 

Thnx for your reply, I am using selenium logging in my local system using log4j, In log4j properties file i have given the Path of E drive where my logs should generate, In my local sysytem 
it is working fine, However when i am executing the same on Hub, it is giving me error "The system cannot find the path specified". How we can enable selenium grid logs so that it should capture on every node.
I have setup the Hub and Nodes through command line, Is there any command which i have to execute on every node so that log file should generate there.
 



⇜Krishnan Mahadevan⇝

unread,
Nov 5, 2018, 5:20:09 AM11/5/18
to seleniu...@googlegroups.com
Can you please help explain to me one more time what is your use case and what you are trying to achieve in a bit more detailed way ?



For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Ajay Verma

unread,
Nov 5, 2018, 5:40:28 AM11/5/18
to seleniu...@googlegroups.com
Hi  Krishnan

I am part of Automation COE, WE have setup the grid  with 8 nodes which is up and running.Below are the commands which i have used for setup of hub and node

HUB:
java -jar C:\selenium-server-standalone-3.14.0.jar -role hub
Node1:
"java -Dwebdriver.ie.driver=C:/driver/IEDriverServer.exe -Dwebdriver.chrome.driver=C:/driver/chromedriver.exe -Dwebdriver.gecko.driver="C:/driver/geckodriver.exe" -jar C:\selenium-server-standalone-3.14.0.jar -port 5555 -role node -hub http://10.236.72.171:4444/grid/register -browser "browserName=firefox, maxInstances=3, platform=WINDOWS" -browser "browserName=internet explorer, version=11, platform=WINDOWS, maxInstances=2" -browser "browserName=chrome,version=ANY,maxInstances=3,platform=WINDOWS" -timeout 120000 -browserTimeout 60000"
Node2:

"java -Dwebdriver.ie.driver=C:/driver/IEDriverServer.exe -Dwebdriver.chrome.driver=C:/driver/chromedriver.exe -Dwebdriver.gecko.driver="C:/driver/geckodriver.exe" -jar C:\selenium-server-standalone-3.14.0.jar -port 5556 -role node -hub http://10.236.72.171:4444/grid/register -browser "browserName=firefox, maxInstances=3, platform=WINDOWS" -browser "browserName=internet explorer, version=11, platform=WINDOWS, maxInstances=2" -browser "browserName=chrome,version=ANY,maxInstances=3,platform=WINDOWS" -timeout 120000 -browserTimeout 60000"  

Likewise we have created 8 nodes....

I am able to execute my selenium executions on all the nodes well(except Logging). I am using LOG4J for logging purpose, Below is my Log4j property file
log4j.logger.devpinoyLogger=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.maxFileSize=900KB
log4j.appender.dest1.maxBackupIndex=6
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss} %c %m%n
log4j.appender.dest1.File=E:\\Selenium_logs\\logs.log
log4j.appender.dest1.Append=false

When i am running my script in local machine, I am getting the logs in E drive.
I have created a folder on every node with Selenium_logs in E drive, However when i run my execution on nodes i am getting this error "E:\Selenium_logs\logs.log (The system cannot find the path specified)"

Is there any console command(as we setup the node)  which i need to run in order to turn  logging on in each node.



Ajay Verma

unread,
Nov 12, 2018, 2:34:40 AM11/12/18
to seleniu...@googlegroups.com
Hi  Krishnan 

Could you please help:

I am part of Automation COE, WE have setup the grid  with 8 nodes which is up and running.Below are the commands which i have used for setup of hub and node

HUB:
java -jar C:\selenium-server-standalone-3.14.0.jar -role hub
Node1:
"java -Dwebdriver.ie.driver=C:/driver/IEDriverServer.exe -Dwebdriver.chrome.driver=C:/driver/chromedriver.exe -Dwebdriver.gecko.driver="C:/driver/geckodriver.exe" -jar C:\selenium-server-standalone-3.14.0.jar -port 5555 -role node -hub http://10.236.72.171:4444/grid/register -browser "browserName=firefox, maxInstances=3, platform=WINDOWS" -browser "browserName=internet explorer, version=11, platform=WINDOWS, maxInstances=2" -browser "browserName=chrome,version=ANY,maxInstances=3,platform=WINDOWS" -timeout 120000 -browserTimeout 60000"
Node2:

"java -Dwebdriver.ie.driver=C:/driver/IEDriverServer.exe -Dwebdriver.chrome.driver=C:/driver/chromedriver.exe -Dwebdriver.gecko.driver="C:/driver/geckodriver.exe" -jar C:\selenium-server-standalone-3.14.0.jar -port 5556 -role node -hub http://10.236.72.171:4444/grid/register -browser "browserName=firefox, maxInstances=3, platform=WINDOWS" -browser "browserName=internet explorer, version=11, platform=WINDOWS, maxInstances=2" -browser "browserName=chrome,version=ANY,maxInstances=3,platform=WINDOWS" -timeout 120000 -browserTimeout 60000"  

Likewise we have created 8 nodes....

I am able to execute my selenium executions on all the nodes well(except Logging). I am using LOG4J for logging purpose, Below is my Log4j property file
log4j.logger.devpinoyLogger=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.maxFileSize=900KB
log4j.appender.dest1.maxBackupIndex=6
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss} %c %m%n
log4j.appender.dest1.File=E:\\Selenium_logs\\logs.log
log4j.appender.dest1.Append=false

When i am running my script in local machine, I am getting the logs in E drive.
I have created a folder on every node with Selenium_logs in E drive, However when i run my execution on nodes i am getting this error "E:\Selenium_logs\logs.log (The system cannot find the path specified)"

Is there any console command(as we setup the node)  which i need to run in order to turn  logging on in each node.

Regards
Ajay Verma

Krishnan Mahadevan

unread,
Nov 12, 2018, 10:35:54 PM11/12/18
to seleniu...@googlegroups.com

Ajay,

I don’t think the error you are facing has anything to do with Selenium. It seems to be more of a log4j issue (log4j is not able to either find the file or perhaps there is some permission issues which is preventing the file from being created (I have seen Java complain with the same error for permission issues as well).

 

So you might want to take a look at that angle.

 

>>> Is there any console command(as we setup the node)  which i need to run in order to turn on logging on in each node.

Not that I am aware of. You have a “-debug” flag which turns on debug logs and prints them on the console (You could use a redirection operator “>” to redirect it to a file though), but that’s not the same as managing logs via a logging framework such as log4j.

 

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

Reply all
Reply to author
Forward
0 new messages