⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 generallogevent.java

📁 日志组件,添加到应用中,可在数据库中查询日志
💻 JAVA
字号:
package com.gisinfo.common.log.general;

import com.gisinfo.common.log.LogEvent;
import com.gisinfo.common.log.Level;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * User: Ken
 * Date: 2008-6-17
 * Time: 13:58:59
 */

/**
 * 请查看 GeneralLogger方法找寻对应关系
 */
public class GeneralLogEvent extends LogEvent {
    // id  ip  who  where  when  action  lvl systemName  what  description
    protected String id;              //编号
    protected String who;            //操作者,如 admin
    protected String where;          //在哪里,如 方法A
    protected String action;         //执行的动作, 如查看
    protected String what;           //动作的对象, 如图层A
    protected String lvl;            //日志的级别的显示,参考Level
    protected String ip;             //操作者的IP 如127.0.0.1
    protected String systemName;    //系统名称 如权限系统

    //info(String who, String action, String what, String description, String where, String ip, String systemName)
    @Override
    public String toString() {
        String res = new StringBuilder()
                .append(sdf.format(this.when))
                .append("\t").append(this.level)
                .append("\t").append(this.who)
                .append("\t").append(this.action)
                .append("\t").append(this.what)
                .append("\t").append(this.description)
                .append("\t").append(this.where)
                .append("\t").append(this.ip)
                .append("\t").append(this.systemName)
                .toString();
        return res;
    }

    public GeneralLogEvent(String id, String who, Date when, String where, String action, String what, String description, String ip, String systemName) {
        this.id = id;
        this.who = who;
        this.where = where;
        this.action = action;
        this.what = what;
        this.when = when;
        this.description = description;
        this.ip = ip;
        this.systemName = systemName;
    }


    public GeneralLogEvent() {
    }

    static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getWho() {
        return who;
    }

    public void setWho(String who) {
        this.who = who;
    }

    public String getSystemName() {
        return systemName;
    }

    public void setSystemName(String systemName) {
        this.systemName = systemName;
    }

    public String getWhere() {
        return where;
    }

    public void setWhere(String where) {
        this.where = where;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getWhat() {
        return what;
    }

    public void setWhat(String what) {
        this.what = what;
    }

    public String getLvl() {
        return this.level == null ? null : level.toString();
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public static SimpleDateFormat getSdf() {
        return sdf;
    }

    public static void setSdf(SimpleDateFormat sdf) {
        GeneralLogEvent.sdf = sdf;
    }
}

⌨️ 快捷键说明

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