In this episode I explain how to do logging in Java using slf4j and logback. Go to java8course.com for additional material like the slides, a pdf, exercises and other videos.
In Lesson 6, you mention that you advise beginners to start with a text-editor so we get used to JAVA code... that was not so friendly advice. I struggled for about 4 days trying to use slf4j and getting errors like "unable to instantiate an Appender of type 'ch.qos.logback.ConsoleAppender'... DynamicClassLoadingExcerption" That type of error is hard to troubleshoot for a beginner. I downloaded Eclipse after giving up on logback in Sublime. I still had to troubleshoot (in the Eclipse IDE), but at least it took about 2 hours to find the solution this time. Starting with text editor is bad advice. IDE's are the way to go.
Working with a text editor is hard. But it will make you learn and understand Java much more deeply. I never said it was easy. This is tough. Tough is how we learn fast! :) However, on this advice I am not so sure about anymore... My mistake was that I didn't use a text editor myself to show you how...
@@MarcusBiel Yes, please... I'm not at all saying that using a text editor is bad... But I am saying that if I spend 4 days trying to find the reason why 'ConsoleAppender' is not being found on my system, then it's very discouraging. As a complete beginner, I didn't even know that "com.benedict.javalessons" means there's a folder called "com" and a folder inside it called "benedict". I didn't know it until I was reading different documentation and they were telling me to search the target folder (which I didn't have). It's frustrating, it made me start blaming my computer and my operating system without realizing what the problem was. Even now, I haven't found the solution to that problem on logback with slf4j... I am now using the log4j because the ConsoleAppender there is simpler to troubleshoot. I appreciate the fact that I am learning (especially since some of my problems forced me to learn what a debugger is, what a compiler is and why we need a linker) but it is frustrating to troubleshoot before even writing the first software.
In this episode of my free Java video course I would like to introduce you to logging. Actually, what is logging? First of all, let’s tell you what my idea is. I have prepared this little test here. I have prepared a little class “carService”. I wanted to process this string “BMW” or Bimmer and in the class, this class so far is empty. My idea is I want to be notified in some way like a print out on the console into a file, the database or maybe even an email or something so I want to be notified in some way. I want to monitor if someone calls this method so that I later on can go through all the calls and can see if something happened. For example if my system was hacked I could go through file and see what time, what happened and then analyze it. That’s the idea. The way this is done is by logging...
The purpose of the video was to explain logging, using the state of the art "tools". What purpose is it to waste time comparing log4j to logback - logback is its sucessor, period. If you need such a comparison, you should be able to find a lot of these online :)
Quite an interesting beginning of your video, I expected to learn something useful about slf4j logging, which I did, nut I also leaned new stuff about sailing history :)
Thanks for your great explanation :-) By the way, what is that window on the right side when you execute test? In my environment, I can see just log messages.
What kind of environment are you using? Eclipse maybe? In this video, I am using IntelliJ IDEA 14 Ultimate. If you refer to the green bar - it's just the "run view" that appears when I execute a test.
Thanks for replying. I'm using IntelliJ 2016.3 Ultimate so when I execute tests I can see the logs and the green bar. But as in the video (time - 19:31), there's an table under the green bar. The table shows some useful information to users. But I've never seen this before. So I want to know what is that :-)
In the video at 19:31 you can see a blue settings wheel in the bottom left corner, in the run view. Click on it, then select "Show Statistics". That should do the trick - let me know.
I found a option "show inline statistics" in the settings drop-down menu. But it doesn't show me a table like that. I think there's some modifications after some version updates. IntelliJ official reference also says there's an option as you mentioned but it's not. Anyway, you helped me a lot. Thank you very much :)
Dude, there are about 13k people that would disagree with you. Also, I don't really get your point. I do my Java tutorials with a lot of passion in my free time - no one forces you to watch them.
Thank you for great and brief overview about java logging and logback functions. Great lessons with straight and clear descriptions and examples.
You're welcome! :)
What an excellent tutorial, very informative and excellent presentation. Thank you for the video
Good Lecture!
and thanks for subtitles
In Lesson 6, you mention that you advise beginners to start with a text-editor so we get used to JAVA code... that was not so friendly advice.
I struggled for about 4 days trying to use slf4j and getting errors like "unable to instantiate an Appender of type 'ch.qos.logback.ConsoleAppender'... DynamicClassLoadingExcerption"
That type of error is hard to troubleshoot for a beginner. I downloaded Eclipse after giving up on logback in Sublime.
I still had to troubleshoot (in the Eclipse IDE), but at least it took about 2 hours to find the solution this time.
Starting with text editor is bad advice. IDE's are the way to go.
Working with a text editor is hard. But it will make you learn and understand Java much more deeply. I never said it was easy. This is tough. Tough is how we learn fast! :) However, on this advice I am not so sure about anymore... My mistake was that I didn't use a text editor myself to show you how...
@@MarcusBiel Yes, please... I'm not at all saying that using a text editor is bad... But I am saying that if I spend 4 days trying to find the reason why 'ConsoleAppender' is not being found on my system, then it's very discouraging.
As a complete beginner, I didn't even know that "com.benedict.javalessons" means there's a folder called "com" and a folder inside it called "benedict". I didn't know it until I was reading different documentation and they were telling me to search the target folder (which I didn't have). It's frustrating, it made me start blaming my computer and my operating system without realizing what the problem was.
Even now, I haven't found the solution to that problem on logback with slf4j... I am now using the log4j because the ConsoleAppender there is simpler to troubleshoot.
I appreciate the fact that I am learning (especially since some of my problems forced me to learn what a debugger is, what a compiler is and why we need a linker) but it is frustrating to troubleshoot before even writing the first software.
that part about chip log blowed my mind hahaa :D
Just great, nice and easy way of teaching, detailed.
In this episode of my free Java video course I would like to introduce you to logging. Actually, what is logging? First of all, let’s tell you what my idea is. I have prepared this little test here. I have prepared a little class “carService”. I wanted to process this string “BMW” or Bimmer and in the class, this class so far is empty. My idea is I want to be notified in some way like a print out on the console into a file, the database or maybe even an email or something so I want to be notified in some way. I want to monitor if someone calls this method so that I later on can go through all the calls and can see if something happened. For example if my system was hacked I could go through file and see what time, what happened and then analyze it. That’s the idea. The way this is done is by logging...
Your teaching method is extremely easy to understand. Thank you so much.
Thank you ! Very useful information you have provided.
Dude, Thanks so much, the best part for me is the beginning of the video! I like to know where things start ... soooo good :D...
Your weclome :)
Great video explaining logger
Nice tutorial Marcus Biel....
Thanks Marcus for the explanation on logback. It would have been good if you have covered what are all the advantages of logback over log4j.
The purpose of the video was to explain logging, using the state of the art "tools". What purpose is it to waste time comparing log4j to logback - logback is its sucessor, period. If you need such a comparison, you should be able to find a lot of these online :)
thanks, very informative.
Thank you for tutorial!
Quite an interesting beginning of your video, I expected to learn something useful about slf4j logging, which I did, nut I also leaned new stuff about sailing history :)
You're welcome :)
Thumbs up!
Thanks a lot!
You're welcome
Thank you very much for awesome video and explanation.
Special thanks for the easy understandable speech. :)
Your welcome! :)
Nice intro level video for beginners
Muito boa explicação parabéns !
Muito obrigado :)
Great explanation of logging rules and configuration with logback, thanks!
Thanks, Kamil! Anything I could improve?
Great explanation
Thanks ☺
Thanks for your great explanation :-)
By the way, what is that window on the right side when you execute test?
In my environment, I can see just log messages.
What kind of environment are you using? Eclipse maybe? In this video, I am using IntelliJ IDEA 14 Ultimate. If you refer to the green bar - it's just the "run view" that appears when I execute a test.
Thanks for replying. I'm using IntelliJ 2016.3 Ultimate so when I execute tests I can see the logs and the green bar. But as in the video (time - 19:31), there's an table under the green bar. The table shows some useful information to users. But I've never seen this before. So I want to know what is that :-)
In the video at 19:31 you can see a blue settings wheel in the bottom left corner, in the run view. Click on it, then select "Show Statistics". That should do the trick - let me know.
I found a option "show inline statistics" in the settings drop-down menu. But it doesn't show me a table like that. I think there's some modifications after some version updates. IntelliJ official reference also says there's an option as you mentioned but it's not.
Anyway, you helped me a lot. Thank you very much :)
I don't know about IntelliJ 2016.3 Ultimate, maybe there are differences? Contact their support, maybe they can help you?
Ahoy you
country choppy. We still use books for logging in the navy. ;-)
sir why all the collection classesimplementing clonable interface?
czcams.com/video/0_V-z6QcaWc/video.html
Do you have a tutorial, where you use the FileAppender?
Sorry, currently not. This is my only tutorial about logging so far.
Refer logback.qos.ch/manual/index.html for FileAppender.
How the logback.xml is created?
it's just a text file. You can just open a new file, put this content into it, and save it as "logback.xml".
@@MarcusBiel I have the same question before seeing ur replay
"I want to process this String: "BMW" or "bhmhwh""
What does that even mean xd
thx but you talked a lot to explain something quite simple?
Great if it is simple for you, but, as you can see here in the comments, it's not so simple for everyone! :)
True I guess.
dude, it's too few stuff for 30 min talking...
Dude, there are about 13k people that would disagree with you. Also, I don't really get your point. I do my Java tutorials with a lot of passion in my free time - no one forces you to watch them.
I liked your video BTW, but I believe u can more!
Great that you have confidence in my skills! ;)