I am trying to migrate from velocity 1.7 where I use LogChute interface. In my current implementation I have used the log method to get the velocity log level and comparing our own log level. Please see the code below.
@Override
public void log(int level, String message) {
LogLevel projLevel = null;
switch ( level )
{
case LogChute.DEBUG_ID:
projLevel = LogLevel.DEBUG ;
break ;
case LogChute.INFO_ID:
projLevel = LogLevel.INFO ;
break ;
case LogChute.WARN_ID:
projLevel = LogLevel.WARNING ;
break ;
case LogChute.ERROR_ID:
projLevel = LogLevel.ERROR ;
break ;
default:
projLevel = LogLevel.ERROR ;
break ;
}
if (Log.canLog(projLevel, Const.VELOCITY_LOGGER))
{
Log.log(projLevel, Const.VELOCITY_LOGGER, getClass(), message,
null);
}
}
Based on apache velocity 2.0 documentation the LogChute is deprecated and the apache velocity is using SLF4J for logging. So, I tried to use SLF4j-API and SLF4J bindings as SLF4J Simple Logger and WebApp SLF4J Logger but unable to utilize the class as I need to compare the velocity log levels with our custom log levels. All these needs to happened during runtime.
For current velocity configuration, I am following the below configuration this is same as custom class which is invoked based on 1.7 velocity configuration as services.VelocityService.runtime.log.logsystem.class=our.package.xclassName.
Here's the link for documentation(https://velocity.apache.org/engine/1.7/developer-guide.html#configuring-logging)
These all are removed in 2.0 version.
Can someone help me on this. I am trying to upgrade the velocity.