Error in velocity and log4J

前端 未结 6 1565
梦谈多话
梦谈多话 2021-01-04 00:29

I built a webapp that works perfectly fine in my localhost (tomcat). But when I tried to deploy, velocity crashes in init(), leaving me with this strange stack trace here (s

6条回答
  •  执笔经年
    2021-01-04 00:59

    I too had same Issue but I was able to resolve this overriding the default log file to customized log file. Just add this 3 lines of code in the method where you are calling evaluate Function.

    Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,"org.apache.velocity.runtime.log.Log4JLogChute");
    
    Velocity.setProperty("runtime.log.logsystem.log4j.logger","com.mindtree.igg.website.email.TemplateMergeUtilVelocityImpl");
    
    VelocityContext velocityContext = new VelocityContext(parameters);
    

    This is one way of solving it ie, without using property file.

提交回复
热议问题