Yes that's fine to control the logging.
You should also look at the log4j documentation - there's a lot more fancy stuff you can do. You can also control logging through the JMX console, so for example if you are on WebSphere then the logging will be integrated with the other logging on the admin console.
If you are interested in developing then you may also want to look at the java debugger since that's the other tool for problem diagnosis.