1 package chapter4.sub.sample; 2 3 import org.slf4j.Logger; 4 import org.slf4j.LoggerFactory; 5 6 public class Bar { 7 Logger logger = LoggerFactory.getLogger(Bar.class); 8 9 public String toString() { 10 return "test 123"; 11 } 12 13 public void createLoggingRequest() { 14 subMethodToCreateRequest(); 15 } 16 17 //this is done to create a stacktrace of more than one line 18 private void subMethodToCreateRequest() { 19 logger.error("error-level request", new Exception("test exception")); 20 } 21 }