升级 log4j到 log4j2 解决boot日志兼容问题,修复头像更新问题
This commit is contained in:
parent
cead0b5b2d
commit
e9682694a0
|
@ -8,8 +8,8 @@ import com.len.service.RoleService;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
@ -23,7 +23,8 @@ import org.springframework.context.annotation.Configuration;
|
|||
@Configuration
|
||||
public class DataSourceJobThread extends Thread {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DataSourceJobThread.class);
|
||||
private static Logger log = LogManager.getLogger(DataSourceJobThread.class);
|
||||
|
||||
@Autowired
|
||||
RoleService roleService;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.len.core.BootListener;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
|
|||
@Component
|
||||
public class MyApplicationListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(MyApplicationListener.class);
|
||||
Logger logger = LogManager.getLogger(MyApplicationListener.class);
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,30 +1,56 @@
|
|||
package com.len.core.quartz.CustomQuartz;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
|
||||
import com.len.core.annotation.Log;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/29.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 定时还原数据库数据
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class DataSchdule {
|
||||
|
||||
//@Scheduled(cron="0/5 * * * * ? ")
|
||||
public static void restData() throws IOException, InterruptedException {
|
||||
String sqlPath = "G:\\os\\sql\\lenos_test.sql"; // SQL文件路径
|
||||
String[] execCMD = new String[]{"mysql", "lenos_test", "-u" + "root", "-p" , "-e source", sqlPath};
|
||||
Process process = Runtime.getRuntime().exec(execCMD);
|
||||
private static Logger logger = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
|
||||
|
||||
int processComplete = process.waitFor();
|
||||
if (processComplete == 0) {
|
||||
System.out.println("还原成功.");
|
||||
} else {
|
||||
throw new RuntimeException("还原数据库失败.");
|
||||
// @Scheduled(cron = "0 0/5 * * * ? ")
|
||||
@Log(type = Log.LOG_TYPE.UPDATE,desc = "定时还原数据库")
|
||||
public static void restData() throws IOException, InterruptedException {
|
||||
// SQL文件路径
|
||||
try {
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
String sqlPath = "G:\\os\\sql\\lenos_test.sql";
|
||||
Process process = rt
|
||||
.exec("D:\\java\\mysql-5.7.21-winx64\\mysql-5.7.21-winx64\\bin\\mysql.exe -hlocalhost -uroot -ppassword --default-character-set=utf8 "
|
||||
+ "lenos_test");
|
||||
OutputStream outputStream = process.getOutputStream();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(sqlPath), "utf-8"));
|
||||
String str = null;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
while ((str = br.readLine()) != null) {
|
||||
sb.append(str + "\r\n");
|
||||
}
|
||||
str = sb.toString();
|
||||
OutputStreamWriter writer = new OutputStreamWriter(outputStream,
|
||||
"utf-8");
|
||||
writer.write(str);
|
||||
writer.flush();
|
||||
outputStream.close();
|
||||
br.close();
|
||||
writer.close();
|
||||
logger.info("数据库还原成功");
|
||||
} catch (IOException e) {
|
||||
logger.error("数据库还原失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,11 +7,12 @@ import com.len.service.impl.SysUserServiceImpl;
|
|||
import com.len.util.SpringUtil;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +23,8 @@ import org.springframework.context.ApplicationContext;
|
|||
* 定时测试类
|
||||
*/
|
||||
public class JobDemo2 implements Job{
|
||||
private static Logger logger= LoggerFactory.getLogger(JobDemo2.class);
|
||||
|
||||
private static Logger logger = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.len.entity.SysJob;
|
|||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.JobBuilder;
|
||||
|
@ -16,8 +18,6 @@ import org.quartz.SchedulerException;
|
|||
import org.quartz.Trigger;
|
||||
import org.quartz.TriggerBuilder;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -34,7 +34,7 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class JobTask {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(JobTask.class);
|
||||
private static Logger log = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
|
||||
|
||||
@Autowired
|
||||
SchedulerFactoryBean schedulerFactoryBean;
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.len.core.shiro;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.ExcessiveAttemptsException;
|
||||
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
|
||||
import org.apache.shiro.cache.Cache;
|
||||
import org.apache.shiro.cache.CacheManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
|
@ -17,7 +18,8 @@ import cn.hutool.core.util.StrUtil;
|
|||
* 限制尝试登陆次数,防止暴力破解
|
||||
*/
|
||||
public class RetryLimitCredentialsMatcher extends HashedCredentialsMatcher {
|
||||
private static final Logger log = LoggerFactory.getLogger(RetryLimitCredentialsMatcher.class);
|
||||
|
||||
private static Logger log = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
|
||||
|
||||
private Cache<String, AtomicInteger> loginRetryCache;
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
<div class="layui-input-block">
|
||||
<input type="email" id="email" value="${user.email}" style="width: 93%" name="email" lay-verify="email"
|
||||
autocomplete="off" class="layui-input">
|
||||
<input id="photo" name="photo" type="hidden">
|
||||
<input id="photo" value="${user.photo}" name="photo" type="hidden">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
|
Loading…
Reference in New Issue