0

I am trying to migrate to Velocity 2.0 from 1.7. After reading some of the documentation, I see that Velocity now has moved on to the SLF4j API for its logging. Now I am not a an expert on how to use SLF4j, but since it has some documentation, I am sure I will figure it out.

public class VelocityLogger implements LogChute

I had a class which implemented the LogChute interface. After reading a bit about the new logging framework, would:

SimpleLogger

be an apt replacement? I just want to know if my analysis at the start is correct, before I mess it up going down the wrong path.

Naman
  • 27,789
  • 26
  • 218
  • 353
hell_storm2004
  • 1,401
  • 2
  • 33
  • 66

1 Answers1

1

There is no replacement for LogChute, the slf4j logging framework works statically. You only need to provide one (and only one) slf4j implementation (aka backend) package along with the slf4j-api one in your classpath.

And yes, it can be the SimpleLogger or logback, as long as some bridge towards another logging framework or some other implementation, there are a few out there.

I wrote one specifically to redirect logs towards the logger of the J2EE container: webapp-slf4j-logger. You'll find an example of integration in the velocity-tools-example-showcase webapp.

Claude Brisson
  • 4,085
  • 1
  • 22
  • 30
  • Thanks for the help. That example was really nice. Although I haven't tested it yet, but I was able to get the code to compile just fine. – hell_storm2004 Feb 11 '19 at 13:50