1 package com.openinventions.webappfilter.processor; 2 3 import com.openinventions.metaframework.*; 4 import org.apache.commons.logging.*; 5 6 public class Logger implements Processor { 7 private static final Log log = LogFactory.getLog(Logger.class); 8 9 public void process(State state, Element context) throws Exception { 10 if (context.getValue("level").equals("debug")) { 11 Log debug = LogFactory.getLog(context.getValue("section")); 12 debug.debug(context.getValue("message")); 13 } else if (context.getValue("level").equals("info")) { 14 Log info = LogFactory.getLog(context.getValue("section")); 15 info.info(context.getValue("message")); 16 } else if (context.getValue("level").equals("warn")) { 17 Log warn = LogFactory.getLog(context.getValue("section")); 18 warn.warn(context.getValue("message")); 19 } else if (context.getValue("level").equals("error")) { 20 Log error = LogFactory.getLog(context.getValue("section")); 21 error.error(context.getValue("message")); 22 } else if (context.getValue("level").equals("fatal")) { 23 Log fatal = LogFactory.getLog(context.getValue("section")); 24 fatal.fatal(context.getValue("message")); 25 } else { 26 log.error("level not supported " + context.getValue("level")); 27 } 28 } 29 } 30 81 | Popular Tags |