Must Know JAVA concepts | Selenium Automation | PART – 5 | Log4j | Indepth & Complete tutorial
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:
Properties file content reference:
Conversion pattern explanation:
XML file content reference:
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): YouTube comment section
Also, you can follow me on Facebook and Instagram.
Facebook:
Instagram:
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.
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?
Excellent teaching
Making new to software like me to understand concepts
Hi Arul, This video is very useful for me, and i executed successfully my script also
Great 👍
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.
yes bro for me to same error
dheivamae u r great
plz continue to do such videos we will support u
Thank you so much for this great explanation
😊
Sir in this video for Basic configurator.. %x denotes?
Excellent explanation…
Neenga yepdi debug pannuvinga
In eclipse if facing issue in script
Do u use log file instead of debugging
Excellent sir
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
@Learn Automation Online 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
Are you getting the output or u r getting the exception and the program is not proceeding further?
Thank you.
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?
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 .
is there any pre requitse regarding log4j? ipodhan first time ipdi oru video pakren enaku romba different a eruku
@Learn Automation Online ok bro
This is the only video for log4j you will need. I have explained almost everything with respect to log4j. No prerequisites to this
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
Nice bro romba romba nandri
Thanks a lot……
💝
Yes, for errors u will use error, for general message, u will use logger info , warning and so on.
@Learn Automation Online 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 ……
U will use logger only in production ready framework. When u r just learning. U can use sysout
Very nice explanation 😁 I was waiting for a session like this.. Keep rocking.. 😎
Thanks a lot. Keep learning. 😊
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
Glad it was helpful!
pls upload new version if possible
There’s no big difference. In cucumber framework playlist I have explained log4j2. Please refer them
@Learn Automation Onlinesure… thank you…
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?
Almost. Different name for different implementation. Function same