資源簡介
log4j的簡單用法
第一步:建立工程Log4jDemo
第二步:加入jar包log4j-1.2.8.jar
第三步:src下添加log4j.properties文件,內容如下
代碼片段和文件信息
package?com.ant.log4j;
import?org.apache.log4j.Logger;
public?class?HelloLog4j?{
private?static?Logger?logger?=?Logger.getLogger(HelloLog4j.class);
public?static?void?main(String[]?args)?{
//記錄debug級別的信息
logger.debug(“This?is?debug?message!“);
//記錄info級別信息
logger.info(“This?is?info?message!“);
//記錄error級別信息
logger.error(“This?is?error?message!“);
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????290??2013-01-06?13:29??.classpath
?????目錄???????????0??2018-07-02?22:26??.idea\
?????文件?????????202??2018-07-02?22:00??.idea\encodings.xm
?????目錄???????????0??2018-07-02?22:27??.idea\inspectionProfiles\
?????文件?????????258??2018-07-02?21:59??.idea\misc.xm
?????文件?????????258??2018-07-02?21:59??.idea\modules.xm
?????文件???????22391??2018-07-02?22:26??.idea\workspace.xm
?????文件?????????385??2013-01-06?13:29??.project
?????目錄???????????0??2018-07-02?21:58??.settings\
?????文件?????????100??2013-01-06?13:29??.settings\org.eclipse.core.resources.prefs
?????文件?????????960??2018-07-02?21:59??Log4jDemo.iml
?????目錄???????????0??2018-07-02?22:11??WebRoot\
?????目錄???????????0??2018-07-02?22:12??WebRoot\logs\
?????文件?????????112??2018-07-02?22:12??WebRoot\logs\info_
?????目錄???????????0??2018-07-02?22:12??bin\
?????目錄???????????0??2018-07-02?22:00??bin\com\
?????目錄???????????0??2018-07-02?22:00??bin\com\ant\
?????目錄???????????0??2018-07-02?22:12??bin\com\ant\log4j\
?????文件?????????808??2018-07-02?22:00??bin\com\ant\log4j\HelloLog4j.class
?????目錄???????????0??2018-07-02?22:00??bin\com\ant\log4jDAO\
?????文件?????????750??2018-07-02?22:00??bin\com\ant\log4jDAO\HelloDAO.class
?????文件????????1547??2018-07-02?22:11??bin\log4j.properties
?????目錄???????????0??2018-07-02?21:58??lib\
?????文件??????352668??2013-01-06?13:29??lib\log4j-1.2.8.jar
?????文件????????2677??2013-01-06?15:31??log4j說明.txt
?????目錄???????????0??2018-07-02?22:10??src\
?????目錄???????????0??2018-07-02?21:58??src\com\
?????目錄???????????0??2018-07-02?21:58??src\com\ant\
?????目錄???????????0??2018-07-02?21:58??src\com\ant\log4j\
?????文件?????????422??2013-01-06?13:29??src\com\ant\log4j\HelloLog4j.java
?????目錄???????????0??2018-07-02?21:58??src\com\ant\log4jDAO\
............此處省略2個文件信息
- 上一篇:mybatis+spring集成
- 下一篇:java連接數據庫
評論
共有 條評論