Implementing good logging in an application can be challenging. Using args4j we can easily set the root logging level of log4j via a command line parameter.
Introduction
When it comes to logging in Java, log4j2 is a wide-used framework. For small applications, using the configuration files to change the log level might be a bit of an overkill and a command line parameter is much more appropriate. If you don’t want to parse the command line parameters yourself, you can use a framework for that. args4j uses annotations to automatically populate the fields or properties of an object with the appropriate command line parameters.
In my recent project, I had the challenge of combining those two.