文章列表
http://topic.csdn.net/u/20080602/14/6fcde7ba-57b3-4dac-a2c7-ac65dd26a64c.html?7640
http://hi.baidu.com/yangkailin0123/blog/item/c2213d1e5b13131440341713.html
package com.log.model;
import java.util.Date;
public class LogInfoModel
{
public LogInfoModel()
{
}
// 日志ID
private Long logId ;
// 操作时间
private Date operateDate;
// 操作人员
private String operatorName;
// 操作类
private String logClass;
...
package com.log.test;
import java.util.Date;
import org.apache.log4j.Logger;
import com.log.model.LogInfoModel;
public class LogManager
{
private static LogManager instance = new LogManager();
private static Logger logger = Logger.getLogger(LogManager.class);
/**
* 私有 & ...
<!--
Log4J Configuration Quick Reference:
====================================
Priority order is DEBUG < INFO < WARN < debug < FATAL
PatternLayout conversion characters:
%c Category of the logging event
%C Fully qualified class name of the caller
%d Date of the ...
<!--
level:是日记记录的优先级,优先级由高到低分为
OFF ,FATAL ,ERROR ,WARN ,INFO ,DEBUG ,ALL。
Log4j建议只使用FATAL ,ERROR ,WARN ,INFO ,DEBUG这四个级别。
-->
<!-- 指定logger的设置,additivity指示是否叠加输出log,如果是false,
在DsErrorLog logger中日志不会被其它logger满足条件的logger(比如root)
输出 ...
<!--输出方式是:每天一个日志文件-->
<!--设置通道名称是:file,输出方式DailyRollingFileAppender-->
<appender name="myFile" class="org.apache.log4j.DailyRollingFileAppender">
<!--日志文件路径和文件名称 -->
<!-- 加../在logs,加/在C盘,不加在bin目录 -->
<!--
如果在加载时设置了变量Sy ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<!--输出方式:输出到控制台-->
<appender name= ...
import java.util.Date;
import org.apache.log4j.xml.DOMConfigurator;
import com.log.model.LogInfoModel;
import com.log.test.LogManager;
public class LogTest
{
public static void main(String[] args)
{
// 使用properties配置log4j
// PropertyConfigurator.configure("log4j.properti ...