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);

For the root logger you can use

Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);



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””