-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestLog.java
More file actions
27 lines (22 loc) · 814 Bytes
/
Copy pathTestLog.java
File metadata and controls
27 lines (22 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package test;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.Properties;
/**
* Created by geguangfu on 2017/10/11.
*/
public class TestLog {
static Logger logger = Logger.getLogger(TestLog.class);
public static void main(String[] args) throws IOException {
System.out.println("程序启动");
Properties pro = new Properties();
System.out.println("加载配置文件");
pro.load(TestLog.class.getResourceAsStream("/config.properties"));
System.out.println("姓名:【"+pro.getProperty("NAME")+"】年龄:【"+pro.getProperty("AGE")+"】");
logger.debug("debug......");
logger.info("info......");
logger.warn("warn.....");
logger.error("error....");
logger.fatal("fatal.....");
}
}