日志组件,添加到应用中,可在数据库中查询日志
源代码在线查看: testlog2.java.svn-base
package com.gisinfo.test;
import com.gisinfo.common.log.Logger;
import com.gisinfo.common.log.LogEventOccur;
import com.gisinfo.common.log.LogEvent;
import com.gisinfo.common.log.general.GeneralLogEvent;
import com.gisinfo.common.log.general.GeneralLogger;
import java.io.IOException;
/**
* User: Ken
* Date: 2008-5-20
* Time: 16:47:09
*/
public class TestLog2 {
public static void main(String[] args) throws IOException, InterruptedException {
GeneralLogger log = GeneralLogger.getCustomLogger("b");
GeneralLogger log2 = GeneralLogger.getLogger(TestLog2.class);
//Logger log2 = Logger.getCustomLogger("b");
//Logger log3 = Logger.getCustomLogger("c");
/*log.addEventOccurHandler(new LogEventOccur() {
public void handleLogEvent(LogEvent event) {
//System.out.println("@@@@@@@@@@@@@"+event.getDescription());
}
});*/
//log.addLogWriter(new ConsoleWriter());
while(true){
for (int i = 0; i < 1; i++) {
if(i%2==0)log.debug("Ken", "登陆", "权限系统", "用户Ken登陆权限系统!" + i);
else log.info("Ken", "访问", "图层A", "用户Ken登陆权限系统!" + i,"模块A","192.168.100.100","权限系统");
log2.debug("SystemAdmin", "登陆", "权限系统", "用户Ken登陆权限系统!" + i);
//log3.debug(new SimpleLogEvent("Ken", "192.168.0.1", "权限系统", "登陆", "权限系统", "用户Ken登陆权限系统!" + i));
}
Thread.sleep(1000);
}
}
}