log 4 jでよく見られる5つのレベル

1062 ワード

1、レベルの説明
レベル順(低~高):DEBUG2、テスト例
/**
 * @Title:LogLevel.java
 * @Package:com.you.log
 * @Description:log4j 
 * @Author:  
 * @date: 2014 7 8   10:58:41
 * @Version V1.2.3
 */
package com.you.log;

import org.apache.log4j.Logger;


/**
 * @ :Log
 * @ : ( ): DEBUG < INFO < WARN < ERROR < FATAL
 * @Author:Administrator
 * @date: 2014 7 8   10:58:41
 */
public class LogLevel 
{
	private static final Logger logger = Logger.getLogger(LogLevel.class);
	/**
	 * @Title : main
	 * @Type : Log
	 * @date : 2014 7 8   10:58:41
	 * @Description : 
	 * @param args
	 */
	public static void main(String[] args) 
	{
		logger.warn(" ");
		logger.info(" ");
		logger.fatal(" ");
		logger.error(" ");
		logger.debug(" ");
	}

}

3、テスト結果
2014-07-08 23:13:06,140  WARN (com.you.log.LogLevel:32) -  
2014-07-08 23:13:06,143 FATAL (com.you.log.LogLevel:34) -  
2014-07-08 23:13:06,144 ERROR (com.you.log.LogLevel:35) -