How to Generate Log Files in Selenium Webdriver

  Рет қаралды 123,325

Mukesh otwani

Mukesh otwani

Күн бұрын

In this video, we will mainly discuss How to Generate Log Files in Selenium Webdriver and different type of logs available.
Full article can be found below
learn-automatio...
In this video, I have covered how to create log files using log4j.
learn-automatio...
You can also generate Advance log report using Extent report.
I have a detailed article on this which will help you to generate report with logs in it.
learn-automatio...
Please Share, Support and Subscribe and let’s spread the knowledge
KZbin - / mukeshotwani
Facebook Group- / 256655817858291
Facebook -
/ seleniumwebdrivermukesh
Google + - plus.google.co...
Twitter- / mukeshotwani
Instagram- / mukeshotwani
Checkout my another blog
mynewsyourviews...
~-~~-~~~-~~-~
Please watch: "How To Create Maven build For Selenium Framework"
• How To Create Maven bu...
~-~~-~~~-~~-~

Пікірлер: 109
@priyanshisaxena6252
@priyanshisaxena6252 5 жыл бұрын
Thanks Mukesh for explaining so beautifully what exactly log files are. As always your explanation is to the point and easy to understand.
@RajdeepBiswasInd
@RajdeepBiswasInd 9 жыл бұрын
Bohot badhiya barkhuddar!
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
+Rajdeep Biswas Thanks Rajdeep Bhai
@manueltenorio7543
@manueltenorio7543 9 жыл бұрын
hey, thanks! this was very clear... haha, I didn't have an Idea what the log files were, but I understand they are useful for making software. I need to initialize my log4j system properly because a remote server which I want to access sends the message: "no appenders could be found for logger". Have a great week!
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
Manuel Tenorio Hey Manuel Thanks I will recommend please refer extent reports as well. Please refer below tutorial kzbin.info/www/bejne/sITNqJqgi9FnhpY it actually generate logs and pie chart, bar graph and so on.
@rakeshlalsangi5254
@rakeshlalsangi5254 9 жыл бұрын
Excellent and easy explanation Mukesh .......
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Thanks Rakesh
@jayakumar6091
@jayakumar6091 9 жыл бұрын
Amazing Explanation thanks a lot Mukesh
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
jaya kumar Thanks Jaya :)
@bonker27125
@bonker27125 6 жыл бұрын
hi mukesh , as u have said we are providing class name to this logger instance . so it means its use is also limited to that class only . in that case how to use it in whole framework ? like if i have 20 classes as a part of POM, then in every class i have to create logger instance ? or is there any other way ? please suggest
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Hi Shobhit, Please use extent report in order to use log effectively
@sakshitiwariskz
@sakshitiwariskz 8 жыл бұрын
yeah i finally got logger thnxs dude :)
@anshulgupta30071990
@anshulgupta30071990 8 жыл бұрын
@Mukesh Sir: Just one help. Is there a way where i can assert my log files. For my application logs are generated for every api hit. So i need to assert a string or data in logs while logs are generated for that hit. Currently i am doing it manually. Is there any external jar file which can be used to perform such assertions. Or any other easier way. Thanks in advance!
@nikilraj5298
@nikilraj5298 10 жыл бұрын
Excellent ..thanks...
@Mukeshotwani
@Mukeshotwani 10 жыл бұрын
Thank Ram
@nidhigarg4996
@nidhigarg4996 8 жыл бұрын
Hi Mukesh I have started watching your videos since yesterday. These are really very helpful. I am facing an issue. When I go to your blog learn-automation.com and select any item from drop-downs then the contents are not loaded completely. After some contents blank page is displayed. Also I need to implement selenium framework in my project. Can you please help me in that. Like where and how can i store the xpaths for all the web elements, Database connection and reports and batch run etc. Do I need to create only one Java Project in Eclipse for all the scripts in my project or I can create multiple Java projects? Please Reply. Thanks a lot
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Nidhi Garg Hi Nidhi, I will check my blog theme and thank you for poiting out. I am going to upload framework in upcoming days.
@nikitasharma2881
@nikitasharma2881 10 жыл бұрын
its really helpful..thanks sir
@Mukeshotwani
@Mukeshotwani 10 жыл бұрын
Thanks Nikita
@monimathur7178
@monimathur7178 7 жыл бұрын
Hi Mukesh.Thanks for the Log4j information. Could you please answer like where are we defining the log max size ? That means what would be the maximum capacity a log could handle?
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Moni, Generally, log files will be in KB so 10 MB is enough (depends on System requirement). I use extent report which has advance logs in HTML file. Have a look learn-automation.com/advance-selenium-reporting-with-screenshots-2/
@monimathur7178
@monimathur7178 7 жыл бұрын
Thanks Mukesh for the update :)
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Welcome moni try and let me know.
@dipeshlpatel
@dipeshlpatel 6 жыл бұрын
Hi Mukesh, This is brilliant and works perfectly fine with a chrome browser. However, when we have 5 chrome browser thread and using log4j for parallel testing, it does not show efficient test steps flow for tests due to multi-thread execution. Can you please help by sharing your expertise what changes required for efficient logging in multi-thread environment?
@dipakpardeshi6152
@dipakpardeshi6152 6 жыл бұрын
hi Mukesh thanks for creating video its very helpfull for me, i performed all step for log4j but after run my program i can see logs in my consol but -> in project directory -> in log folder -> all 2 notepad and 1 html log file are empty, you have any idea where i"m doing mistake.
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Hey Dipak, Seems some version issue. Which version you are using? You can also try extent report which is latest which gives logs in report directly. learn-automation.com/advance-selenium-reporting-with-screenshots-2/
@debajyoti1990
@debajyoti1990 6 жыл бұрын
Yes, I have faced the same problem. Looking for solutions now..
@debajyoti1990
@debajyoti1990 6 жыл бұрын
by the way, Thanks a ton Mukesh for the awesome work that you've been doing..
@abhishekvaishnav
@abhishekvaishnav 8 жыл бұрын
I really liked the video and the way you explained things -pretty simple. I have a query _ I need to store some keys for password encryption in logs while doing encryption and also recover the keys from log at time of decryption since I'm using random key encryption. I understood how to store them, but can retrieving them in a program be easy?
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
not good in this.
@abhishekvaishnav
@abhishekvaishnav 8 жыл бұрын
no problemo :)
@vipinpandey75
@vipinpandey75 6 жыл бұрын
Hi Mukesh, Thanks for such wonderful tutorial. I have one query how Can we configure log file in such a way that it will generate a new html file and log file with class name /Testscript name for each execution. ?
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
HI Vipin, we use extent report now a days for logs and html report. learn-automation.com/advance-selenium-reporting-with-screenshots-2/
@anilmor3652
@anilmor3652 8 жыл бұрын
You are Great bro. :) Thanks for the video.
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Thanks Anil. I am glad to know it helped you
@abhijitbiradar
@abhijitbiradar 8 жыл бұрын
Hi Mukesh, Thanks for video. I have a query.can we create a new log file every time using log4j. Means every time when i run program it should create new log file.
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hey Abhijit, I will suggest use extent report which generates logs in HTML format.
@saifurDYI
@saifurDYI 10 жыл бұрын
Awesome Idea dude
@Mukeshotwani
@Mukeshotwani 10 жыл бұрын
Thanks Rahman
@shankarpk89
@shankarpk89 4 жыл бұрын
Hi Mukesh, Can you please help me understand the difference between log4j and webdriver event listener ?
@anuragsngh16
@anuragsngh16 6 жыл бұрын
Hi Mukesh , I am able to generate logs using log4j API. But logs which are getting generated contains logs of WebDriver & TestNG along with my custom logs. How should I configure so that I can get only my logs. Thanks in advance
@shankarashok6599
@shankarashok6599 5 жыл бұрын
Hi Sir Your videos are damn good. In fact no one can match the intensity of your good. Thanks for all your effort. I have one questions regarding the logs. That is in what way does System.out.println(); differs from logs if we replace syso from log it works in the same way right. Or any difference is there.
@girinivasmanivasagam3965
@girinivasmanivasagam3965 7 жыл бұрын
Hi Mukesh, I'm getting below error while following your steps. I'm able to get logs in CONSOLE, HTML and R. But i'm not able to get the logs for TTCC and I'm getting the below error on execution. What should I do? log4j:ERROR Could not find value for key log4j.appender.TTCC log4j:ERROR Could not instantiate appender named "TTCC".
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Log 4j is missing which is causing the issue.
@girinivasmanivasagam3965
@girinivasmanivasagam3965 7 жыл бұрын
Mukesh otwani Thank you
@pranalikumbhare3547
@pranalikumbhare3547 8 жыл бұрын
Hi..... It necessary to set "log4j.properties" in every program. because, when I didn't t set it , it shows me the warn messages... Please suggest me.....
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Yes Pranali if you dont want warnings.
@davidvasanthraj
@davidvasanthraj 8 жыл бұрын
Hi Mukesh, Does the .properties file is same for all codes, all it applicable for your example alone
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi David it will be applicable to all . I will suggest u to use new logs with report kindly check kzbin.info/www/bejne/mnPNaKOunb-Lnrs
@davidvasanthraj
@davidvasanthraj 8 жыл бұрын
Thank you.bro...Now it's clear.
@DeepakKumar2105
@DeepakKumar2105 6 жыл бұрын
Hi Sir, can you tell us why two log files are generated viz testlog and testlog1.I think only one file should be generated.
@nalinyogeshwarrdwivedi9657
@nalinyogeshwarrdwivedi9657 6 жыл бұрын
Hi Mukesh ...unable to find Log4j.properties file on system..or please guide how to create it as in video you directly showed the file and continued. Thanks
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Hi Nalin, you have to create this file manuall check out my post for this learn-automation.com/how-to-create-log-files-in-selenium/
@nalinyogeshwarrdwivedi9657
@nalinyogeshwarrdwivedi9657 6 жыл бұрын
Thanks Mukesh ...I found the file from blog....added it to the project folder but I am facing "No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies). log4j:WARN Please initialize the log4j system properly" this issue on mac system. Please guide. Thanks.
@ashishgawande6235
@ashishgawande6235 5 жыл бұрын
Thank you sir for the brilliant video. I am facing the issue while generating the log file. log file. only the blank log files are getting generated. can you please guide me further.
@SuperMechtronics
@SuperMechtronics 7 жыл бұрын
Wonderful explanation
@nmshaik9668
@nmshaik9668 7 жыл бұрын
Hi Tried my self log4g, script will successfully pass and able to generate log folder but that notepad folder showing empty. please tell me mukesh.
@kshirodsahu3391
@kshirodsahu3391 7 жыл бұрын
Hi Mukesh, Thanks for such wonderful tutorial. I have one quarry Can we configure log file in such a way that it will generate a new html file and log file with class name /Testscript name for each execution.
@vipinpandey75
@vipinpandey75 6 жыл бұрын
+mukesh otwani please help me on the same issue.
@WilsonMar1
@WilsonMar1 7 жыл бұрын
Are the files shown somewhere downloadable, such as GitHub?
@faisalsakib9810
@faisalsakib9810 6 жыл бұрын
hi , can we use maven repository to have 4j jar ???
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Hi Faisal, Please use below dependency org.apache.logging.log4j log4j-core 2.11.0
@TheSumisri
@TheSumisri 8 жыл бұрын
When I download Apache poi in that log4 jar is available so is it necessary that again I need to download separately
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Yes
@inMeditation_PSSM
@inMeditation_PSSM 8 жыл бұрын
Beautiful way
@jyshaikh1
@jyshaikh1 7 жыл бұрын
Hi, Continuously getting java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified) - Look like system is looking for log4j.properties file and not found. Where as it is available under /src folder.
@jyshaikh1
@jyshaikh1 7 жыл бұрын
Commented out: PropertyConfigurator.configure(" log4j.properties"); And all good.
@gauravshrote4069
@gauravshrote4069 6 жыл бұрын
unable to generate log file for different java classes .only created log for first java class. can you please help.
@userx481
@userx481 5 жыл бұрын
Mukesh, thank you a lot. I am learning like in a good school from you. Would you know how to add clickable line # in Intelije? I used the same and tried other log4j file content and I am getting this: 0 [main] INFO RandomPractice - Google is launched 17 [main] INFO RandomPractice - Search field is located 143 [main] INFO RandomPractice - Hare Krishna is entered 2126 [main] WARN RandomPractice - Searching for the entered text Whereas I am aiming for getting what you have in the video. I 've heard Inlelije works differently. I have my "log4j.properties" file, may be you can advise what I can add to get the clickable line # or may be there is another way. So far after going to so many blogs, I haven't figured that out. Thank you very much. All the best to you!
@SanatanihinduHinduRashtra
@SanatanihinduHinduRashtra 8 жыл бұрын
how can i use it android program i need everything what ever is happening in the app in the log files please do help me
@karthiknamana
@karthiknamana 9 жыл бұрын
I want LogJ4 property file content . where can i get that text in Property file
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
+karthik namana learn-automation.com/how-to-create-log-files-in-selenium/
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
+karthik namana try this as well kzbin.info/www/bejne/sITNqJqgi9FnhpY
@karthiknamana
@karthiknamana 9 жыл бұрын
thankq +Mukesh otwani . really your blog was awesome . it is very nice
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
Thank you karthik.. Keep visiting.. Have a nice weekend
@nurshah816
@nurshah816 9 жыл бұрын
nice work..
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
Thanks Nur
@sushanthsriram5259
@sushanthsriram5259 8 жыл бұрын
Hello Bhaya ji...I have tired with above code but i got an error, and when i removed 3rd line i.e, propertyconfigurator.configre(); i am able to execute the code
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Thanks Sushanth :) Try extent report too its good for advance logs.
@sreyashshukla9827
@sreyashshukla9827 6 жыл бұрын
if i have to generate different logger file for passed and failed scenario, how will i do it?
@shukrantpatel7024
@shukrantpatel7024 4 жыл бұрын
In my project i have followed same procedure which u told in video but still my logs folder is not generating..please solve my query
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Shukrant, extent report has in built logs and report as well learn-automation.com/extent-report-with-selenium-webdriver/
@neelamchakraborty9062
@neelamchakraborty9062 6 жыл бұрын
hi Mukesh where can i find this code for property file.
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Hi Neelam, You can find the code using below link learn-automation.com/how-to-create-log-files-in-selenium/ Instead of using log4j, i would recommend use extent report which internally uses Log4J. learn-automation.com/extent-report-with-selenium-webdriver/
@Raghu783
@Raghu783 3 жыл бұрын
Hello Mukesh , please increase your voice little bit loud so that we can hear properly.
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Sorry Raghu that was little old video. In recent videos I have improved voice quality.
@SC4K_Online
@SC4K_Online 4 жыл бұрын
getLogger moved to LogManager, can you redo this video
@divyangjani7600
@divyangjani7600 6 жыл бұрын
what is need of it when we have TestNG?
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Hi Divyang if you need in different format then you can use it.
@blablagswjsvsns134
@blablagswjsvsns134 6 жыл бұрын
unable to get configure method in property.configurator. . nothing showing.
@sunkarimounika2696
@sunkarimounika2696 4 жыл бұрын
Hello Mukesh,I followed same procedure.Logs are not getting generated can you please guide me log4j:WARN No appenders could be found for logger (baseClasses.BaseClass). log4j:WARN Please initialize the log4j system properly.
@niky0153
@niky0153 4 жыл бұрын
can u post ur code here?
@beditz1591
@beditz1591 5 ай бұрын
Hi can I paste my code I am not able to generate pls help i am beginner in this field ​@@niky0153
@AbhishekMishra-ru2fi
@AbhishekMishra-ru2fi 8 жыл бұрын
You are just awesome man :) (Y)
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Thanks mate but I would suggest you to continue with advance logs using extent report which is more popular now a days. learn-automation.com/advance-selenium-reporting-with-screenshots-2/
@Bujji28243
@Bujji28243 7 жыл бұрын
Ok good explanations, but hot get property file?
@thiery572
@thiery572 5 жыл бұрын
Thanks.
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Most welcome to my channel
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
I can see that you also have channel on youtube. Let me know if any help required for youtube as well.
@thiery572
@thiery572 5 жыл бұрын
@@Mukeshotwani Hehe.. okay. Thanks. :)
@parveentomar5486
@parveentomar5486 6 жыл бұрын
Sir Kya me apse bat kar skta hu
@amritpalbadhan205
@amritpalbadhan205 7 жыл бұрын
its weird..it seems like its working for everyone except me ..the logs files generated displaying no content and their size is 0kb
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Cheers
@dhananjayapattnaik7428
@dhananjayapattnaik7428 4 жыл бұрын
Admin user can update the user password Given I am in the HR system with an Admin account When I update password of another user Then I receive a message for updating password successfully And user's password is updated to the new passwo
@incognito3174
@incognito3174 8 жыл бұрын
unfortunately I did not understand because I do not speak English. Are there someone who can make me a translation? I speak french and arabic!!
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Sorry bro I can speak only English.
@towhidskynet
@towhidskynet 7 жыл бұрын
6:44 - 6:45
@nmshaik9668
@nmshaik9668 7 жыл бұрын
i Hope , u give reply for me
How to Send Emails in Selenium Webdriver Using Commons email API
19:37
How to execute failed test cases in Selenium webdriver
17:09
Mukesh otwani
Рет қаралды 97 М.
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 21 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 33 МЛН
"كان عليّ أكل بقايا الطعام قبل هذا اليوم 🥹"
00:40
Holly Wolly Bow Arabic
Рет қаралды 12 МЛН
How to Generate Log Files in Selenium using Log4j API
32:50
Naveen AutomationLabs
Рет қаралды 118 М.
P17 - Implicit Wait Timeout in Selenium WebDriver | తెలుగు |
20:48
Log4j2 logging in Selenium Java Framework using Log4j2 Properties & Log4j2 xml
28:24
SDET Adda For QA Automation
Рет қаралды 22 М.
log4j Support in Selenium Cucumber Video-8
9:30
learnby bhanu
Рет қаралды 9 М.
P4 - Understand the log levels in extent reports | Extent Reports |
14:07
How to read properties file || Generate Logs in Selenium - using  Log4j API
49:27
How to Handle Alert in Selenium Webdriver
17:32
Mukesh otwani
Рет қаралды 63 М.
How To Click In Selenium WebDriver Using JavaScriptExecutor
13:31
Mukesh otwani
Рет қаралды 29 М.
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 21 МЛН