Is velocity.log created for Apache Velocity v2.0 by default?

72 Views Asked by At

Since with Apache Velocity v2.0 we have moved to SLF4J, how to handle creation of velocity.log for serverless calls? For example if an AWS lambda function is calling the java code using VTL, during runtime velocity.log will not be able to create. Will an exception be thrown? Do we need to suppress velocity.log from being created? Or velocity.log creation will not happen? Earlier we were using ve.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM_CLASS,NullLogChute.class.getName()); to suppress the log file from getting created.

Current code - ve.setProperty(Velocity.RESOURCE_LOADER,"classpath"); ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName()); ve.init();

1

There are 1 best solutions below

1
On

Switching to SLF4J implies that it's not anymore Velocity which is responsible for creating the log file. Velocity only depends on the SLF4J logging API, which expects to find a logger implementation in the classpath, see Velocity logging doc.

The easiest way to have your log file created is to add slf4j-simple to the classpath, which you can configure using system properties.