Тёмный

Must Know JAVA concepts | Selenium Automation | PART - 5 | Log4j | Indepth & Complete tutorial 

Learn Automation Online
Подписаться 82 тыс.
Просмотров 29 тыс.
50% 1

Logging is one of the essential concepts for any application development or testing process. For Selenium automation also, we have to log the necessary information into a file or database or any other storage medium.
Jars Download link: bit.ly/2W5J6lK
Properties file content reference: bit.ly/2sYyGZu
Conversion pattern explanation: bit.ly/2HmemK3
XML file content reference: bit.ly/2FBJMKM
What will we learn in this video:
---------------------------------------------------
1. What is logging?
2. Why do we need a logger?
3. How can we achieve logging in Java?
4. Log4j Components
5. Priority Levels
6. Different ways to configure log4j
1. What is logging?
Logging is the process of writing log messages during the execution of a program to a central place.
2. Why do we need Logs?
If we use SOP (System.out.print()) statements to print log messages We can print log messages on the console only. So, when the console is closed, we will lose all of those logs.
3. Log4j Components
a)Logger
b)Appender
c)Layout
4. Log4j priority levels:
debug, info, warn, error, fatal
5. Different ways to configure log4j:
a) Basic configurator
b) Property File Configurator
c) XML configurator (DOMConfigurator)
#LearnAutomationOnline #Java #Log4j #InDepth #50thVideo
Best way to reach me (replies will be faster): RU-vid comment section
Also, you can follow me on Facebook and Instagram.
Facebook: bit.ly/2TqPlis
Instagram: bit.ly/2Ez36rH

Опубликовано:

 

18 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 94   
@rameshkannan8220
@rameshkannan8220 3 года назад
Hi Arul ! Thanks for this Log4j video. I was searching this content in many you tube videos and finally a got a full stuff ( Like full meals :-) ). Please keep up your good work. - Ramesh Kannan
@LearnAutomationOnline
@LearnAutomationOnline 3 года назад
Glad it was helpful!
@rvthym89
@rvthym89 Год назад
Great Video and happy to know that the best content on testing is available in tamil. Keep Posting
@arunvikrama
@arunvikrama 3 года назад
Excellent teaching Making new to software like me to understand concepts
@madhanjohn10
@madhanjohn10 3 года назад
Hi Arul, This video is very useful for me, and i executed successfully my script also
@LearnAutomationOnline
@LearnAutomationOnline 3 года назад
Great 👍
@Jaikumar-xq8br
@Jaikumar-xq8br 2 года назад
Seriously superb explanation, I'm following your java and automation videos really awesome. I have never seen this type of explanation and Its very depth and really helpful for understanding the concepts.
@dhanasusila77
@dhanasusila77 Год назад
Excellent Explaination Arul! Thanks a lot !
@mugundhans8536
@mugundhans8536 2 года назад
dheivamae u r great plz continue to do such videos we will support u
@sethuchiyan16
@sethuchiyan16 Год назад
Hi Arul, good detailed info on log4j, Thank you !
@sivaneshwaran8627
@sivaneshwaran8627 Год назад
Good work, clear explanation
@BharathiManohar-fl5yi
@BharathiManohar-fl5yi Год назад
excellent information..thanku so much
@sylesh1306
@sylesh1306 Год назад
You're the best sir..
@johnkeneddy6466
@johnkeneddy6466 2 года назад
Clean Explanation Arul Bro 👏👏
@sylesh1306
@sylesh1306 Год назад
Thankyou for this knowledge
@yesjay1335
@yesjay1335 4 года назад
Excellent explanation...
@skccharan
@skccharan Год назад
Thank you
@suganthi1435
@suganthi1435 3 года назад
Thank you so much for this great explanation
@LearnAutomationOnline
@LearnAutomationOnline 3 года назад
😊
@srigurumurthy5754
@srigurumurthy5754 Год назад
great explanation bro
@thechennaicook8961
@thechennaicook8961 5 лет назад
Very nice explanation 😁 I was waiting for a session like this.. Keep rocking.. 😎
@LearnAutomationOnline
@LearnAutomationOnline 5 лет назад
Thanks a lot. Keep learning. 😊
@sathishraju5749
@sathishraju5749 4 года назад
Excellent sir
@LokeshA-nl1qu
@LokeshA-nl1qu Год назад
Thanks😊, You are underrated😢
@learnwithpraveen7536
@learnwithpraveen7536 11 месяцев назад
Some key didn't display what will I do sir
@arunprashathgangatharan4689
@arunprashathgangatharan4689 2 года назад
Hi Arul, very nice explanation, What does mean slf4j ?
@vkknocks3551
@vkknocks3551 3 года назад
Hi Arul, Video on Log4J was really good. I need a clarification as I was tying to implement the concept in my project. Project is a MAVEN project and i have added the dependencies "org.apache.logging.log4j" with version 2.14.0 . File getting imported is "import org.apache.logging.log4j.Logger". and when I am getting an error on this statement ---> static Logger logger = Logger.getLogger(Propertylog4jExample.Class); I am getting a compile time error on Propertylog4jExample.Class. Could you please help me on this.
@kadhaikalamvaanga9824
@kadhaikalamvaanga9824 2 года назад
yes bro for me to same error
@karthikkeyan2017
@karthikkeyan2017 5 лет назад
Hi my small doubt is while using Property file we mentioned RollingFile Appender but in xml, we used File Appender but final outcome was same for both scenarios. Are both same?
@LearnAutomationOnline
@LearnAutomationOnline 5 лет назад
Almost. Different name for different implementation. Function same
@sriramrao8565
@sriramrao8565 Месяц назад
This version log4j is no longer available. please visit some other tutorial.
@nareshs4631
@nareshs4631 4 года назад
Sir in this video for Basic configurator.. %x denotes?
@prabakarm5025
@prabakarm5025 4 года назад
Neenga yepdi debug pannuvinga In eclipse if facing issue in script Do u use log file instead of debugging
@saravanakumarramasamy8603
@saravanakumarramasamy8603 Год назад
hi bro kindly increase the video quality..
@udhayasankara5442
@udhayasankara5442 3 месяца назад
hi arul i got FileNotFoundException
@sridevisuresh2554
@sridevisuresh2554 3 года назад
Arul, is it possible to provide the log4j XML tags in the same XML sheet where we run our test cases from and for the Properties configurator also, where we have the config.properties file?
@AmarNath-qf1nr
@AmarNath-qf1nr 2 года назад
Is it required to learn the formats of XML file and Properties file or copy pasting from Google would suffice ? I understood the explanation but those formats are a bit difficult to grasp.
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
If u understand the contents of the file, it is enough. It's not easy to remember it the first time, but when u do it regularly, u will grasp it
@AmarNath-qf1nr
@AmarNath-qf1nr 2 года назад
Ok brother... thank you
@suriyakb4299
@suriyakb4299 Год назад
Bro en nama intha logger ah static podurom
@LearnAutomationOnline
@LearnAutomationOnline Год назад
We need only one logger
@Fatyboy
@Fatyboy Год назад
Sir... Sudden a ....namba code theriyama mistake panni.. Ethachii error or exception vanthu ... Log4j pa enna varum.... Because athukaparam Iruka testcase um run agathu so ... Athu epdi sir... Pleased explain me
@LearnAutomationOnline
@LearnAutomationOnline Год назад
Previous ah log statements la ethu varaikum iruko athukapram execute agala nu identify panika vendithan
@Fatyboy
@Fatyboy Год назад
@@LearnAutomationOnline oh... Okay sir... Illa athukum vera ethachii techniques irukumoo ... Nenachita. Sir ...
@Mohan-sj4fz
@Mohan-sj4fz Год назад
Hi Sir! i am happy to say that i have learned many concepts with your support and can you please come up with new video of Logger4java, because there no option in buildpath to refer jar folder in classpath level and more log4j jar while extract from web and cant import the above statement in my eclipse
@LearnAutomationOnline
@LearnAutomationOnline Год назад
When adding the jar, click on classpath under libraries, u will see the add external jar button enabled.
@Mohan-sj4fz
@Mohan-sj4fz Год назад
@@LearnAutomationOnline Hi sir there is no classpath under libraries(this is problem i am facing), i could see in your video and not in my eclipse & in addition to that i am happy to share i have learned selinium, test NG and Maven and java concepts and many more. all this as become possible just because of your videos.Thank you
@LearnAutomationOnline
@LearnAutomationOnline Год назад
@@Mohan-sj4fz if u learnt maven, why struggling with adding jars manually, simply add the maven dependency for log4j.
@Mohan-sj4fz
@Mohan-sj4fz Год назад
@@LearnAutomationOnline i have successfully added log4j dependencies in new maven project which has two jar and your logger4j video you have added only one jar which is in java project and in my system came to know not able to refer those jar in classpath(option not available in library section) which is simple java project, not maven project.Sir!! Now i will be able to practice with maven project. Thank you so much!!!
@Mohan-sj4fz
@Mohan-sj4fz Год назад
@@LearnAutomationOnline Sir! i cannot create object for logger class. import statement is also sugesting me to create class 'logger' in package 'org.apache.log4j'
@alwinj4229
@alwinj4229 2 года назад
bro error method epdi use panuvom ippo namaku oru process nadakidhu but adhu vandhu wrong way agidhu na adhe ippo sout le if else use panni "is wrong" ne solre mari namme logger.error ("is error/wrong") nu sollellame edi ellam use panikelama pls reply
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
U will use logger only in production ready framework. When u r just learning. U can use sysout
@alwinj4229
@alwinj4229 2 года назад
@@LearnAutomationOnline bro ok bro is clear but production le dhan kekeran ippo informations kudakaradhu epdinu soninge framework run agumbo Adhu mari oru logger.error : endhe mari use panuvom Eg: ippo framework run panni pathitu any errors irendha then namme inge error irekenu define panuvomaa Using. Logger.error("error in login page ")idhu mari Pls reply bro You can say any small eg bro ......
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
Yes, for errors u will use error, for general message, u will use logger info , warning and so on.
@alwinj4229
@alwinj4229 2 года назад
Nice bro romba romba nandri Thanks a lot...... 💝
@LifeLessionsAcademy
@LifeLessionsAcademy 2 года назад
now logger is available in java also.. is both the same or different.
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
Different
@elakyad1384
@elakyad1384 2 года назад
I executed the Properties file concept, no exception is coming the log is successfully created, but the details are missing the pattern is missing, only the messages are displaying. Can you say why?
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
Make sure the patter you have given in the property file is correct. May be the pattern changed now. Search in Google and try out different patterns to see if something is changing .
@manikandankm3974
@manikandankm3974 4 года назад
Hi Bro , When i execute the program , i am getting the below error . ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. I am not sure why it is looking for log4j2 configuration file - the filename which i dont have
@LearnAutomationOnline
@LearnAutomationOnline 4 года назад
Are you getting the output or u r getting the exception and the program is not proceeding further?
@manikandankm3974
@manikandankm3974 4 года назад
@@LearnAutomationOnline No output and Program is not executing further , No log file generation in the specified path . I am getting this exception . I have log4j.properties as well with the contents given by you
@sriluxman
@sriluxman 2 года назад
Log4J: Summa therika vidalaaama... Cyber security: Macha.. Sachiputa macha! 😳 Minecraft: Game over
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
😅
@abuthahir9342
@abuthahir9342 2 года назад
Wat realy hpnd?
@PriyaDharshini-bf1hq
@PriyaDharshini-bf1hq 2 года назад
is there any pre requitse regarding log4j? ipodhan first time ipdi oru video pakren enaku romba different a eruku
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
This is the only video for log4j you will need. I have explained almost everything with respect to log4j. No prerequisites to this
@PriyaDharshini-bf1hq
@PriyaDharshini-bf1hq 2 года назад
@@LearnAutomationOnline ok bro
@mahendrarajv3892
@mahendrarajv3892 Год назад
Sir %x means you will not said sir
@rajmohammed6229
@rajmohammed6229 Год назад
Hi Arul, getting this error Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger at log4jExamples.BasicConfiguratorExample.(BasicConfiguratorExample.java:8) Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 1 more
@sundharyuvi8221
@sundharyuvi8221 4 года назад
How to give a executable jar
@LearnAutomationOnline
@LearnAutomationOnline 4 года назад
You can use export option in eclipse to generate executable jar. Please refer to maven series I have explained in detail about these processes.
@sundharyuvi8221
@sundharyuvi8221 4 года назад
@@LearnAutomationOnline thanks bro
@LifeLessionsAcademy
@LifeLessionsAcademy 2 года назад
pls upload new version if possible
@LearnAutomationOnline
@LearnAutomationOnline 2 года назад
There’s no big difference. In cucumber framework playlist I have explained log4j2. Please refer them
@LifeLessionsAcademy
@LifeLessionsAcademy 2 года назад
@@LearnAutomationOnlinesure... thank you...
@surendransms6350
@surendransms6350 8 месяцев назад
Bro onnume puriyala bro
@கொக்கரகோசேனல்
Why java consept
@LearnAutomationOnline
@LearnAutomationOnline 4 года назад
Purila!! Ena keka varinga
@கொக்கரகோசேனல்
Bro number send me
@LearnAutomationOnline
@LearnAutomationOnline 4 года назад
Sorry bro. I'm not comfortable in sharing my number. You can ask your doubts, in comments or on Instagram
@கொக்கரகோசேனல்
I am 10 th patichuruken java kojam therium ana piriya matinkuthu itha concept la atha
@LearnAutomationOnline
@LearnAutomationOnline 4 года назад
Neenga straight ah intha videos pakringla, illa selenium videos lam pathutu pakringla. Ungaluku java venumna neenga straight ah java videos paklam. Ithellam java use pani daily life la, oru software professional ku ena thevayo atha explain panirupen
@vijiviji-jq4wr
@vijiviji-jq4wr 5 лет назад
What is the configuration to write in Database
@LearnAutomationOnline
@LearnAutomationOnline 5 лет назад
I dont understand your question. You are asking how to write the logs to database? I presume!
@vijiviji-jq4wr
@vijiviji-jq4wr 5 лет назад
@@LearnAutomationOnline yes..
@LearnAutomationOnline
@LearnAutomationOnline 5 лет назад
No that's not advisable. Data base operations are costly. We should not write logs into database.
@vijiviji-jq4wr
@vijiviji-jq4wr 5 лет назад
@@LearnAutomationOnline OK Arul.. Tq..
@pavithras2304
@pavithras2304 Год назад
Bro i get this error. Please reply log4j:ERROR Could not instantiate class [org.apache.log4.PatternLayout]. java.lang.ClassNotFoundException: org.apache.log4.PatternLayout at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:375) at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198) at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327) at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:797) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:395) at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:403) at log4jExample.PropertyConfiguratorlog4jExample.main(PropertyConfiguratorlog4jExample.java:11) [PropertyConfiguratorlog4jExample] [ERROR] error msg [PropertyConfiguratorlog4jExample] [WARN] warning msg [PropertyConfiguratorlog4jExample] [FATAL] fatal msg PropertyConfiguratorlog4jExample: package log4jExample; import org.apache.log4j.PropertyConfigurator; import org.testng.log4testng.Logger; public class PropertyConfiguratorlog4jExample { static Logger logger = Logger.getLogger(PropertyConfiguratorlog4jExample.class); public static void main(String[] args) { PropertyConfigurator.configure("log4j.properties"); logger.debug("debug msg"); logger.info("info msg"); logger.warn("warning msg"); logger.error("error msg"); logger.fatal("fatal msg"); } } log4j.properties: #Root logger log4j.rootLogger = INFO, file #configuration to print into file #Appender log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=C:\\Users\\Pavithra\\Downloads\\log\\logging.log log4j.appender.file.MaxFileSize=12MB log4j.appender.file.MaxBackupIndex=10 #Layout log4j.appender.file.layout=org.apache.log4.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n Created a folder name - log. Like you said deleted the logging file
@krishs-ms8ym
@krishs-ms8ym Год назад
Thank you for the tutorial
@benittoraja5957
@benittoraja5957 2 года назад
Thank you.
Далее
Prank Orchestra
00:10
Просмотров 1,9 млн