Class LogTool

  • All Implemented Interfaces:
    java.io.Serializable

    @DefaultKey("log")
    @ValidScope("application")
    public class LogTool
    extends SafeConfig
    implements java.io.Serializable

    This tool is used to log from within templates.

    Of course, the desired log level must have been configured, using the method specific to the SLF4J implementation you are using. For instance, when using the webapp-slf4j-logger, you will use the following snippet of code in you /WEB-INF/web.xml file:

     <context-param>
       <param-name>webapp-slf4j-logger.level</param-name>
       <param-value>debug</param-value>
     </context-param>
     

    You can optionnaly specify the logger name in the config (the default is to re-use the engine logger):

     <tools>
       <toolbox scope="application">
         <tool class="org.apache.velocity.tools.generic.LogTool"/>
       </toolbox>
     </tools>
     
    Since:
    VelocityTools 3.0
    Version:
    $Id: $
    Author:
    Claude Brisson
    See Also:
    Serialized Form
    • Constructor Detail

      • LogTool

        public LogTool()
    • Method Detail

      • error

        public void error​(java.lang.String message)
      • warn

        public void warn​(java.lang.String message)
      • info

        public void info​(java.lang.String message)
      • debug

        public void debug​(java.lang.String message)
      • trace

        public void trace​(java.lang.String message)