private static void velocityLogError(Class cl){
if(velocityCtx.get() != null){
Context ctx = velocityCtx.get();
InternalContextAdapter ica = new InternalContextAdapterImpl(ctx);
com.dotcms.repackage.org.apache.log4j.Logger logger = map.get(VelocityServlet.class);
logger.error("#--------------------------------------------------------------------------------------");
logger.error("#");
if(ica.getCurrentMacroName() != null){
logger.error("# Velocity Error");
}
if(ctx.get("VTLSERVLET_URI") != null && ctx.get("host") != null ){
logger.error("# on url : " + ((Host) ctx.get("host")).getHostname() + ctx.get("VTLSERVLET_URI") );
}
else if(ctx.get("VTLSERVLET_URI") != null ){
logger.error("# on uri : " + ctx.get("VTLSERVLET_URI") );
}
else if(ctx.get("host") != null){
logger.error("# on host : " + ((Host) ctx.get("host")).getHostname() );
}
if(ctx.get("request") != null){
HttpServletRequest req = (HttpServletRequest)ctx.get("request");
if(req.getAttribute("javax.servlet.forward.request_uri") != null){
logger.error("# on req : " + req.getAttribute("javax.servlet.forward.request_uri") );
}
}
if(ica.getCurrentMacroName() != null){
logger.error("# with macro : #" + ica.getCurrentMacroName());
}
if(ica.getCurrentTemplateName() != null){
logger.error("# on template : " + normalizeTemplate(ica.getCurrentTemplateName()));
}
logger.error("# stack:");
for(Object obj : ica.getTemplateNameStack()){
logger.error("# -- " + normalizeTemplate(obj));
}
logger.error("#");
logger.error("#--------------------------------------------------------------------------------------");
}