1 16 package examples.lf5.InitUsingLog4JProperties; 17 18 import org.apache.log4j.Logger; 19 20 import java.io.IOException ; 21 22 43 44 46 public class InitUsingLog4JProperties { 47 51 55 59 private static Logger logger = 60 Logger.getLogger(InitUsingLog4JProperties.class); 61 62 66 70 public static void main(String argv[]) { 71 logger.debug("Hello, my name is Homer Simpson."); 73 logger.debug("Hello, my name is Lisa Simpson."); 74 logger.debug("Hello, my name is Marge Simpson."); 75 logger.debug("Hello, my name is Bart Simpson."); 76 logger.debug("Hello, my name is Maggie Simpson."); 77 78 logger.info("We are the Simpsons!"); 79 logger.info("Mmmmmm .... Chocolate."); 80 logger.info("Homer likes chocolate"); 81 logger.info("Doh!"); 82 logger.info("We are the Simpsons!"); 83 84 logger.warn("Bart: I am through with working! Working is for chumps!" + 85 "Homer: Son, I'm proud of you. I was twice your age before " + 86 "I figured that out."); 87 logger.warn("Mmm...forbidden donut."); 88 logger.warn("D'oh! A deer! A female deer!"); 89 logger.warn("Truly, yours is a butt that won't quit." + 90 "- Bart, writing as Woodrow to Ms. Krabappel."); 91 92 logger.error("Dear Baby, Welcome to Dumpsville. Population: you."); 93 logger.error("Dear Baby, Welcome to Dumpsville. Population: you.", 94 new IOException ("Dumpsville, USA")); 95 logger.error("Mr. Hutz, are you aware you're not wearing pants?"); 96 logger.error("Mr. Hutz, are you aware you're not wearing pants?", 97 new IllegalStateException ("Error !!")); 98 99 100 logger.fatal("Eep."); 101 logger.fatal("Mmm...forbidden donut.", 102 new SecurityException ("Fatal Exception")); 103 logger.fatal("D'oh! A deer! A female deer!"); 104 logger.fatal("Mmmmmm .... Chocolate.", 105 new SecurityException ("Fatal Exception")); 106 } 107 108 112 116 120 } 121 | Popular Tags |