Quantcast
Channel: Java mon amour
Viewing all articles
Browse latest Browse all 1124

SLF4J caveat on formatting

$
0
0
this will simply log NOTHING: in log.info(), the first parameter if it's a String it should be a formatting string, like "{}" .... if there is no format, nothing is logged.

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.List;


public class TestClass {
public static void main(String[] args) {
TestClass testClass = new TestClass();
testClass.test();
}

public void test() {
System.out.println(this.getClass().toString());
Logger log = LoggerFactory.getLogger(this.getClass());
List<String> responses = Arrays.asList("pippo", "pluto");
log.info("", responses);

}
}

Viewing all articles
Browse latest Browse all 1124

Trending Articles