1 17 18 package org.apache.geronimo.jmxdebug.web.velocity; 19 20 import org.apache.velocity.runtime.log.LogSystem; 21 import org.apache.velocity.runtime.RuntimeServices; 22 import org.apache.velocity.runtime.RuntimeConstants; 23 24 import javax.servlet.ServletContext ; 25 26 31 public class ServletLogger { 32 private ServletContext servletContext = null; 33 34 private static final String PREFIX = " Velocity "; 35 36 public ServletLogger(ServletContext sc) { 37 servletContext = sc; 38 } 39 40 43 public void init(RuntimeServices rs) 44 throws Exception { 45 } 46 47 50 public void logVelocityMessage(int level, String message) { 51 52 switch (level) { 53 case LogSystem.WARN_ID: 54 servletContext.log(PREFIX + RuntimeConstants.WARN_PREFIX + message); 55 break; 56 case LogSystem.INFO_ID: 57 servletContext.log(PREFIX + RuntimeConstants.INFO_PREFIX + message); 58 break; 59 case LogSystem.DEBUG_ID: 60 servletContext.log(PREFIX + RuntimeConstants.DEBUG_PREFIX + message); 61 break; 62 case LogSystem.ERROR_ID: 63 servletContext.log(PREFIX + RuntimeConstants.ERROR_PREFIX + message); 64 break; 65 default: 66 servletContext.log(PREFIX + " : " + message); 67 break; 68 } 69 } 70 } 71 | Popular Tags |