View Javadoc

    1   package com.ozacc.mail.impl;
    2
    3   import org.apache.commons.logging.Log;
    4   import org.apache.commons.logging.LogFactory;
    5   import org.apache.velocity.app.Velocity;
    6   import org.apache.velocity.runtime.RuntimeServices;
    7   import org.apache.velocity.runtime.log.LogSystem;
    8
    9   /***
    10   * VelocityのログメッセージをCommonsLoggingを通して出力させるクラス。
    11   *
    12   *
    13   * @see XMLVelocityMailBuilderImpl
    14   * @see JDomXMLMailBuilder
    15   *
    16   * @since 1.0.3
    17   *
    18   * @author Tomohiro Otsuka
    19   * @version $Id: VelocityLogSystem.java,v 1.2.2.1 2004/11/25 08:01:07 otsuka Exp $
    20   */
    21  public class VelocityLogSystem implements LogSystem {
    22
    23  	private static Log log = LogFactory.getLog(Velocity.class);
    24
    25  	/***
    26  	 * @see org.apache.velocity.runtime.log.LogSystem#init(org.apache.velocity.runtime.RuntimeServices)
    27  	 */
    28  	public void init(RuntimeServices rsvc) throws Exception {
    29  	// do nothing
    30  	}
    31
    32  	/***
    33  	 * @see org.apache.velocity.runtime.log.LogSystem#logVelocityMessage(int, java.lang.String)
    34  	 */
    35  	public void logVelocityMessage(int level, String message) {
    36  		switch (level) {
    37  			case DEBUG_ID:
    38  				log.debug(message);
    39  				break;
    40  			case INFO_ID:
    41  				log.info(message);
    42  				break;
    43  			case WARN_ID:
    44  				log.warn(message);
    45  				break;
    46  			case ERROR_ID:
    47  				log.error(message);
    48  				break;
    49  		}
    50  	}
    51
    52  }