[
https://issues.apache.org/jira/browse/VELOCITY-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718315#action_12718315
]
Wim Deblauwe commented on VELOCITY-621:
---------------------------------------
I am using slf4j with Velocity. I just implemented {{LogChute}} interface as
follows:
{code}
private static class Slf4jLogChute implements LogChute
{
@Override
public void init( RuntimeServices runtimeServices ) throws
Exception
{
}
@Override
public void log( int level, String message )
{
switch (level)
{
case DEBUG_ID:
logger.debug( message );
break;
case INFO_ID:
logger.info( message );
break;
case WARN_ID:
logger.warn( message );
break;
case ERROR_ID:
logger.error( message );
break;
}
}
@Override
public void log( int level, String message, Throwable throwable
)
{
switch (level)
{
case DEBUG_ID:
logger.debug( message, throwable );
break;
case INFO_ID:
logger.info( message, throwable );
break;
case WARN_ID:
logger.warn( message, throwable );
break;
case ERROR_ID:
logger.error( message, throwable );
break;
}
}
@Override
public boolean isLevelEnabled( int level )
{
boolean result = false;
switch (level)
{
case DEBUG_ID:
result = logger.isDebugEnabled();
break;
case INFO_ID:
result = logger.isInfoEnabled();
break;
case WARN_ID:
result = logger.isWarnEnabled();
break;
case ERROR_ID:
result = logger.isErrorEnabled();
break;
}
return result;
}
}
{code}
Where {{logger}} is an slf4j Logger.
> Update to SLF4J or workaround?
> ------------------------------
>
> Key: VELOCITY-621
> URL: https://issues.apache.org/jira/browse/VELOCITY-621
> Project: Velocity
> Issue Type: Improvement
> Components: Engine
> Affects Versions: 1.4, 1.5
> Reporter: SebastianWagner
>
> I know that it has been discussed one year ago in VELOCITY-392
> but there is need for at least a workaround for people who are forced to use
> slf4j.
> For example other frameworks did already switch like Hibernate.
> So there is now definitely need for something to enable Velocity to run
> without errors in a environment with log4j-over-slf4j.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]