Class VelocityTemplateService.LogChuteAdapter

  • All Implemented Interfaces:
    org.apache.velocity.runtime.log.LogChute
    Enclosing class:
    VelocityTemplateService

    public static class VelocityTemplateService.LogChuteAdapter
    extends Object
    implements org.apache.velocity.runtime.log.LogChute
    Provides a Velocity LogChute adapter class around the application log service to enable the Velocity Runtime to log to the application LogService.

    Please see the VelocityTemplateService class for more details on Velocity logging.

    PLEASE NOTE this class is not for public use.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.click.service.ConfigService configService
      The application configuration service.
      protected LogService logger
      The application log service.
      protected int logLevel
      The log level.
      • Fields inherited from interface org.apache.velocity.runtime.log.LogChute

        DEBUG_ID, DEBUG_PREFIX, ERROR_ID, ERROR_PREFIX, INFO_ID, INFO_PREFIX, TRACE_ID, TRACE_PREFIX, WARN_ID, WARN_PREFIX
    • Constructor Summary

      Constructors 
      Constructor Description
      LogChuteAdapter()  
    • Field Detail

      • configService

        protected org.apache.click.service.ConfigService configService
        The application configuration service.
      • logger

        protected LogService logger
        The application log service.
      • logLevel

        protected int logLevel
        The log level.
    • Constructor Detail

      • LogChuteAdapter

        public LogChuteAdapter()
    • Method Detail

      • init

        public void init​(org.apache.velocity.runtime.RuntimeServices rs)
                  throws Exception
        Initialize the logger instance for the Velocity runtime. This method is invoked by the Velocity runtime.
        Specified by:
        init in interface org.apache.velocity.runtime.log.LogChute
        Parameters:
        rs - the Velocity runtime services
        Throws:
        Exception - if an initialization error occurs
        See Also:
        LogChute.init(RuntimeServices)
      • isLevelEnabled

        public boolean isLevelEnabled​(int level)
        Tell whether or not a log level is enabled.
        Specified by:
        isLevelEnabled in interface org.apache.velocity.runtime.log.LogChute
        Parameters:
        level - the logging level to test
        Returns:
        true if the given logging level is enabled
        See Also:
        LogChute.isLevelEnabled(int)
      • log

        public void log​(int level,
                        String message)
        Log the given message and optional error at the specified logging level.
        Specified by:
        log in interface org.apache.velocity.runtime.log.LogChute
        Parameters:
        level - the logging level
        message - the message to log
        See Also:
        LogChute.log(int, java.lang.String)
      • log

        public void log​(int level,
                        String message,
                        Throwable error)
        Log the given message and optional error at the specified logging level.

        If you need to customise the Click and Velocity runtime logging for your application modify this method.

        Specified by:
        log in interface org.apache.velocity.runtime.log.LogChute
        Parameters:
        level - the logging level
        message - the message to log
        error - the optional error to log
        See Also:
        LogChute.log(int, java.lang.String, java.lang.Throwable)