1 16 package examples.lf5.UsingLogMonitorAdapter; 17 18 import org.apache.log4j.lf5.LogLevel; 19 import org.apache.log4j.lf5.util.AdapterLogRecord; 20 import org.apache.log4j.lf5.util.LogMonitorAdapter; 21 22 31 32 34 public class UsingLogMonitorAdapter { 35 39 43 private static LogMonitorAdapter _adapter; 47 48 static { 49 _adapter = LogMonitorAdapter.newInstance(LogMonitorAdapter.LOG4J_LOG_LEVELS); 50 } 51 55 59 public static void main(String [] args) { 60 UsingLogMonitorAdapter test = new UsingLogMonitorAdapter(); 61 test.doMyBidding(); 62 } 63 64 public void doMyBidding() { 65 String logger = this.getClass().getName(); 66 67 _adapter.log(logger, "Doh this is a debugging"); 69 70 _adapter.log(logger, LogLevel.INFO, "Hmmm fobidden doughnut"); 71 _adapter.log(logger, LogLevel.WARN, "Danger Danger Will Robinson", 72 new RuntimeException ("DANGER"), "32"); 73 _adapter.log(logger, LogLevel.ERROR, "Exit stage right->"); 74 _adapter.log(logger, LogLevel.FATAL, "What's up Doc?", 75 new NullPointerException ("Unfortunate exception")); 76 } 77 78 82 86 } 90 91 92 93 94 95 | Popular Tags |