What you are talking about is called "commit messages". Logging is used by an application that you are building to store information that is useful for helping find out what happened in error conditions.
As for your questions, I tell junior programmers to try to commit their code at least once every 20 minutes. That seems like a very short time! However, when you are first starting out, it is easy to take on pieces that are really large without realising it. This helps you keep the work small. It also helps you understand when you are in trouble. If you find that you can't commit something in 20 minutes or so, it's a good indication that you probably need some help.
When making your commit message, you should have a short message at the top explaining what you did. To understand what is good to write, imagine that you want to know, "How do I do X". Ideally you can search through the commit history for "X" and you will find a commit that does it. That's a good way to learn how to do things in the code. Now that you know what you want to look for, try to write a message that makes it easy for the "future you" to find it.
Finally, underneath the short commit message, try to write a brief description of why you made your change. If you think it is obvious, there is no reason to write anything. But I find that I write something about 2/3 of my commits. If you find that you can't think of something to say, maybe you are having difficulty understanding why you are doing it yourself! It's sometimes a good idea to ask someone "I know I have to do this, but I don't really understand why. Can you explain it to me?" Very soon, you will understand most things in the code.