Tag Archives: Java

Set log4j2-Log Level via args4j parameters

Screenshot of a terminal executing the program

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.

Continue reading Set log4j2-Log Level via args4j parameters

12 Java Snippets you won’t believe actually compile

“Does that really compile?” you might wonder not just once, but twelve times in a row – while reading this post about interesting, but valid Java syntax.

Our naming conventions have become quite complex recently
Our naming conventions have become quite complex recently

Continue reading 12 Java Snippets you won’t believe actually compile