| | |
| | | package com.ruoyi.framework.manager.factory; |
| | | |
| | | import java.util.TimerTask; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.LogUtils; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | import com.ruoyi.common.utils.ip.AddressUtils; |
| | | import com.ruoyi.common.utils.ip.IpUtils; |
| | |
| | | import com.ruoyi.system.service.ISysLogininforService; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import eu.bitwalker.useragentutils.UserAgent; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * 异步工厂(产生任务用) |
| | |
| | | private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); |
| | | |
| | | /** |
| | | * 记录登陆信息 |
| | | * 记录登录信息 |
| | | * |
| | | * @param username 用户名 |
| | | * @param status 状态 |
| | |
| | | { |
| | | String address = AddressUtils.getRealAddressByIP(ip); |
| | | StringBuilder s = new StringBuilder(); |
| | | s.append(LogUtils.getBlock(ip)); |
| | | s.append(getBlock(ip)); |
| | | s.append(address); |
| | | s.append(LogUtils.getBlock(username)); |
| | | s.append(LogUtils.getBlock(status)); |
| | | s.append(LogUtils.getBlock(message)); |
| | | s.append(getBlock(username)); |
| | | s.append(getBlock(status)); |
| | | s.append(getBlock(message)); |
| | | // 打印信息到日志 |
| | | sys_user_logger.info(s.toString(), args); |
| | | // 获取客户端操作系统 |
| | |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static String getBlock(Object msg) |
| | | { |
| | | if (msg == null) |
| | | { |
| | | msg = ""; |
| | | } |
| | | return "[" + msg.toString() + "]"; |
| | | } |
| | | } |