Update slf4j Log Level Programmatically

Slf4j is an API that sits on top of a logging framework, e.g. Log4j 2, Logback or java.util.logging. So If you want to change the log level, the best way to do this is via the configuration of your logging implementation:

But sometimes, especially in tests it would be nice to see some logging output without changing global configuration files. Slf4j makes this very simple, just get the logger you want to change and set the log level:

Logger restClientLogger = (Logger) LoggerFactory.getLogger(SolrRestClient.class);
restClientLogger.setLevel(Level.DEBUG);

For the root logger you can use

Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.INFO);

 

 

Filter Solr for “Future Date or Not Set”

I’ve worked with some expression languages in my life. I have even created one for my masters thesis. Some of them are easy, some are complicated, some feel smooth, some are strange.

Recently Solr came to my life. Solr also supports some kind of expressions for queries and filters.

Continue reading “Filter Solr for “Future Date or Not Set””

Let’s gain some knowledge!

So I start this blogging thing. Again. But Why?

To gain some knowledge, learn and examine some stuff and write about it. So you, my dear reader, may benefit from my wisdom.

There are so many interesting things in technology out there. So many things to learn, to try, to read about. And to write about, because writing is one of the best forms of learning. As a side-effect, I hope my English writing will improve a little bit too.