1 24 25 27 package weblech.util; 28 29 import org.apache.log4j.*; 30 31 import java.io.IOException ; 32 33 public class Log4j 34 { 35 private static Category _logClass = Category.getInstance(Log4j.class); 36 37 static 38 { 39 Layout l = new PatternLayout("%d [%t] %-5p %F:%L - %m\n"); 40 ConsoleAppender capp = new ConsoleAppender(l); 41 capp.setThreshold(Priority.INFO); 42 BasicConfigurator.configure(capp); 43 try 44 { 45 FileAppender fapp = new FileAppender(l, "weblech.log", false); 46 BasicConfigurator.configure(fapp); 47 System.err.println("Log4j configured to use weblech.log -- view full logging here"); 48 } 49 catch(IOException ioe) 50 { 51 _logClass.warn("IO Exception when configuring log4j: " + ioe.getMessage(), ioe); 52 } 53 _logClass.debug("Log4j configured"); 54 } 55 56 public static void init() 57 { 58 59 } 60 } 61 | Popular Tags |