simpletest.java

来自「设计模式关于LOG的CLL系统」· Java 代码 · 共 50 行

JAVA
50
字号
package cn.edu.nju.software.sd.cll;

public class SimpleTest 
{
	public static void main(String[] args)
	{
		
		
		
		 Logger parentLogger;
		 Logger implChildLogger;
		 Logger noimplChildLogger;
		parentLogger = Logger.getLogger("cn.edu.nju.swi.test");
		implChildLogger = Logger.getLogger("cn.edu.nju.swi.test.impl");
		noimplChildLogger = Logger.getLogger("cn.edu.nju.swi.test.noimpl");
		//implChildLogger.setDestination("console");
		
		parentLogger.log(Level.DEBUG, "parent debug");
		parentLogger.log(Level.INFO, "parent info");
		parentLogger.log(Level.WARNING, "parent warning");
		parentLogger.log(Level.ERROR, "parent error");
		parentLogger.log(Level.FATAL, "parent fatal");

		implChildLogger.log(Level.DEBUG, "implchild debug");
		implChildLogger.log(Level.INFO, "implchild info");
		implChildLogger.log(Level.WARNING, "implchild warning");
		implChildLogger.log(Level.ERROR, "implchild error");
		implChildLogger.log(Level.FATAL, "implchild fatal");

		noimplChildLogger.log(Level.DEBUG, "implnochild debug");
		noimplChildLogger.log(Level.INFO, "implnochild info");
		noimplChildLogger.log(Level.WARNING, "implnochild warning");
		noimplChildLogger.log(Level.ERROR, "implnochild error");
		noimplChildLogger.log(Level.FATAL, "implnochild fatal");
		
		
		//System.out.println(parentLogger.logging.logDestination);
		//System.out.println(Que.que.length());
	
		//System.out.println(noimplChildLogger.logging.logName);
		//System.out.println(noimplChildLogger.logging.logFormat);
		//parentLogger.setFormat("-%n");
		System.out.println(parentLogger.logging.logFormat);
		System.out.println(implChildLogger.logging.logFormat);
		System.out.println(noimplChildLogger.logging.logFormat);
		
		
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?