调整日志等级

This commit is contained in:
LuoYe 2023-01-16 09:14:10 +08:00
parent 81b245a749
commit fd52ede2e8
11 changed files with 17 additions and 28 deletions

View File

@ -94,7 +94,7 @@ public class Start {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
log.info("本轮调用完成!"); log.debug("本轮调用完成!");
} }
/*任务执行*/ /*任务执行*/
@ -108,7 +108,7 @@ public class Start {
@SneakyThrows @SneakyThrows
@Override @Override
public void run() { public void run() {
System.out.println("消费数据: " + value); // System.out.println("消费数据: " + value);
Task.listen(new OutlookMq(value.getGithubId(), value.getId())); Task.listen(new OutlookMq(value.getGithubId(), value.getId()));
this.cdl.countDown(); this.cdl.countDown();
} }

View File

@ -31,7 +31,7 @@ public class GithubAuth2AuthenticationConfig extends SecurityConfigurerAdapter<D
public void configure(HttpSecurity http) throws Exception { public void configure(HttpSecurity http) throws Exception {
GithubLoginAuthenticationFilter authenticationFilter = new GithubLoginAuthenticationFilter(); GithubLoginAuthenticationFilter authenticationFilter = new GithubLoginAuthenticationFilter();
log.info("自定义用户认证处理逻辑"); log.debug("自定义用户认证处理逻辑");
// 自定义用户认证处理逻辑时需要指定AuthenticationManager否则无法认证 // 自定义用户认证处理逻辑时需要指定AuthenticationManager否则无法认证
authenticationFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class)); authenticationFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));

View File

@ -63,7 +63,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
System.out.println("HttpSecurity http"); System.out.println("HttpSecurity http");
/*自定义*/ /*自定义*/
log.info("注册gituhb授权登录"); log.debug("注册gituhb授权登录");
// http.authorizeRequests().antMatchers("/user/login", "/user/loginFrom", "/auth2/getGithubUrl").permitAll()// 指定相应的请求 不需要验证 // http.authorizeRequests().antMatchers("/user/login", "/user/loginFrom", "/auth2/getGithubUrl").permitAll()// 指定相应的请求 不需要验证
//// .and() //// .and()
//// .authorizeRequests().antMatchers("/quartz/**").permitAll()//测试 //// .authorizeRequests().antMatchers("/quartz/**").permitAll()//测试
@ -89,7 +89,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return new ObjectPostProcessor<FilterSecurityInterceptor>() { return new ObjectPostProcessor<FilterSecurityInterceptor>() {
@Override @Override
public <O extends FilterSecurityInterceptor> O postProcess(O object) { public <O extends FilterSecurityInterceptor> O postProcess(O object) {
log.info("加载自定义url权限"); log.debug("加载自定义url权限");
object.setAccessDecisionManager(myAccessDecisionManager); object.setAccessDecisionManager(myAccessDecisionManager);
object.setSecurityMetadataSource(myInvocationSecurityMetadataSourceService); object.setSecurityMetadataSource(myInvocationSecurityMetadataSourceService);
return object; return object;

View File

@ -56,13 +56,13 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
@Override @Override
public boolean supports(ConfigAttribute configAttribute) { public boolean supports(ConfigAttribute configAttribute) {
log.info("进入权限判断! ConfigAttribute configAttribute"); log.debug("进入权限判断! ConfigAttribute configAttribute");
return true; return true;
} }
@Override @Override
public boolean supports(Class<?> aClass) { public boolean supports(Class<?> aClass) {
log.info("进入权限判断! Class<?> aClass"); log.debug("进入权限判断! Class<?> aClass");
return true; return true;
} }
} }

View File

@ -44,7 +44,7 @@ public class UsernamePasswordAuthenticationToken extends AbstractAuthenticationT
super(null); super(null);
this.code = code; this.code = code;
super.setAuthenticated(false); super.setAuthenticated(false);
logger.info("创建未认证的用户名密码认证对象1 setAuthenticated ->false loading ..."); logger.debug("创建未认证的用户名密码认证对象1 setAuthenticated ->false loading ...");
} }
// 创建未认证的用户名密码认证对象 // 创建未认证的用户名密码认证对象
@ -53,7 +53,7 @@ public class UsernamePasswordAuthenticationToken extends AbstractAuthenticationT
this.code = code; this.code = code;
this.state = state; this.state = state;
super.setAuthenticated(false); super.setAuthenticated(false);
logger.info("创建未认证的用户名密码认证对象2 setAuthenticated ->false loading ..."); logger.debug("创建未认证的用户名密码认证对象2 setAuthenticated ->false loading ...");
} }

View File

@ -49,7 +49,7 @@ public class GithubLoginAuthenticationFilter extends AbstractAuthenticationProce
@Override @Override
public Authentication attemptAuthentication(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws AuthenticationException, IOException, ServletException { public Authentication attemptAuthentication(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws AuthenticationException, IOException, ServletException {
log.info("接收github回调参数!"); log.debug("接收github回调参数!");
/*if (!httpServletRequest.getMethod().equals(HttpMethod.POST.name())) { /*if (!httpServletRequest.getMethod().equals(HttpMethod.POST.name())) {
throw new AuthenticationServiceException("不支持该验证方法: " + httpServletRequest.getMethod()); throw new AuthenticationServiceException("不支持该验证方法: " + httpServletRequest.getMethod());
} else { } else {

View File

@ -46,7 +46,6 @@ public class GithubServiceImpl extends ServiceImpl<GithubMapper, Github> impleme
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println(s);
Map<String, String> map = StringUtil.ParsingUrl(s); Map<String, String> map = StringUtil.ParsingUrl(s);
return map.get("access_token"); return map.get("access_token");
} }
@ -57,7 +56,6 @@ public class GithubServiceImpl extends ServiceImpl<GithubMapper, Github> impleme
head.put("Authorization", "token " + access_token); head.put("Authorization", "token " + access_token);
head.put("Content-Type", "application/vnd.github.machine-man-preview+json"); head.put("Content-Type", "application/vnd.github.machine-man-preview+json");
String s = OkHttpClientUtil.doGet("https://api.github.com/user/emails", null,head, null); String s = OkHttpClientUtil.doGet("https://api.github.com/user/emails", null,head, null);
System.out.println(s);
JSONArray jsonArray = JSON.parseArray(s); JSONArray jsonArray = JSON.parseArray(s);
if (!jsonArray.isEmpty()) { if (!jsonArray.isEmpty()) {
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {

View File

@ -61,7 +61,7 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
par.put("grant_type", grant_type); par.put("grant_type", grant_type);
String s = OkHttpClientUtil.doPost("https://login.microsoftonline.com/" + tenantId + "/oauth2/v2.0/token", head, par); String s = OkHttpClientUtil.doPost("https://login.microsoftonline.com/" + tenantId + "/oauth2/v2.0/token", head, par);
JSONObject jsonObject = JSON.parseObject(s); JSONObject jsonObject = JSON.parseObject(s);
logger.info("请求access_token返回数据" + s); logger.debug("请求access_token返回数据" + s);
if (jsonObject.get("error") != null) { if (jsonObject.get("error") != null) {
logger.error("错授权误!"); logger.error("错授权误!");
throw new APIException(jsonObject.get("error_description").toString()); throw new APIException(jsonObject.get("error_description").toString());
@ -102,7 +102,7 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
outlook.setName(name); outlook.setName(name);
outlook.setDescribes(describe); outlook.setDescribes(describe);
outlook.setGithubId(github_id); outlook.setGithubId(github_id);
logger.info(outlook.toString()); logger.debug(outlook.toString());
if (baseMapper.insert(outlook) != 1) { if (baseMapper.insert(outlook) != 1) {
throw new APIException(APiCode.OUTLOOK_INSERT_ERROR); throw new APIException(APiCode.OUTLOOK_INSERT_ERROR);
} }
@ -233,7 +233,7 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
if (!errorCheck(message)) { if (!errorCheck(message)) {
throw new Exception("无法刷新令牌!code:3" + message); throw new Exception("无法刷新令牌!code:3" + message);
} }
logger.info("令牌过期!"); logger.debug("令牌过期!");
/*刷新令牌*/ /*刷新令牌*/
String token = refresh_token(outlook); String token = refresh_token(outlook);
if (token == null) { if (token == null) {
@ -320,10 +320,10 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
par.put("refresh_token", outlook.getRefreshToken()); par.put("refresh_token", outlook.getRefreshToken());
String s = null; String s = null;
s = OkHttpClientUtil.doPost("https://login.microsoftonline.com/" + outlook.getTenantId() + "/oauth2/v2.0/token", head, par); s = OkHttpClientUtil.doPost("https://login.microsoftonline.com/" + outlook.getTenantId() + "/oauth2/v2.0/token", head, par);
logger.info("请求刷新列表返回数据:" + s); logger.debug("请求刷新列表返回数据:" + s);
JSONObject jsonObject = JSON.parseObject(s); JSONObject jsonObject = JSON.parseObject(s);
if (!jsonObject.containsKey("access_token")) { if (!jsonObject.containsKey("access_token")) {
logger.info("返回的access_token字段不存在"); logger.debug("返回的access_token字段不存在");
throw new Exception("返回的access_token字段不存在,无法刷新令牌! 需要重新授权!"); throw new Exception("返回的access_token字段不存在,无法刷新令牌! 需要重新授权!");
} }
outlook.setRefreshToken(jsonObject.getString("refresh_token")); outlook.setRefreshToken(jsonObject.getString("refresh_token"));
@ -332,7 +332,7 @@ public class OutlookServiceImpl extends ServiceImpl<OutlookMapper, Outlook> impl
QueryWrapper<Outlook> queryWrapper = new QueryWrapper<>(); QueryWrapper<Outlook> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("client_id", outlook.getClientId()); queryWrapper.eq("client_id", outlook.getClientId());
if (baseMapper.update(outlook, queryWrapper) != 1) { if (baseMapper.update(outlook, queryWrapper) != 1) {
logger.info("返更新行数不为1"); logger.debug("返更新行数不为1");
throw new Exception("更新数据库时发现有重复的key"); throw new Exception("更新数据库时发现有重复的key");
} }
return outlook.getAccessToken(); return outlook.getAccessToken();

View File

@ -17,7 +17,6 @@ public class StringUtil {
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
String[] split1 = split[i].split("="); String[] split1 = split[i].split("=");
if (split1.length > 1) { if (split1.length > 1) {
System.out.println(split1[0] + " --- " + split1[1]);
map.put(split1[0], split1[1]); map.put(split1[0], split1[1]);
} else { } else {
map.put(split1[0], ""); map.put(split1[0], "");

View File

@ -84,7 +84,7 @@
<loggers> <loggers>
<!--过滤掉spring和hibernate的一些无用的debug信息--> <!--过滤掉spring和hibernate的一些无用的debug信息-->
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="INFO"/>
<logger name="io.qyi.e5" level="debug"/> <logger name="io.qyi.e5" level="INFO"/>
<logger name="org.mybatis" level="INFO"> <logger name="org.mybatis" level="INFO">
<!-- 添加如下设置,控制台会再打印一次 --> <!-- 添加如下设置,控制台会再打印一次 -->
<AppenderRef ref="Console"/> <AppenderRef ref="Console"/>

View File

@ -55,7 +55,6 @@ public class influxdb2Test {
.addFields(beanMap); .addFields(beanMap);
list1.add(point); list1.add(point);
}); });
System.out.println("list 大小:" + list1.size());
Map<String, Object> aa = new HashMap<>(); Map<String, Object> aa = new HashMap<>();
aa.put("a1", 1); aa.put("a1", 1);
writeApi.writePoint("e5", org, list1.get(0)); writeApi.writePoint("e5", org, list1.get(0));
@ -125,9 +124,7 @@ public class influxdb2Test {
for (FluxRecord fluxRecord : records) { for (FluxRecord fluxRecord : records) {
// System.out.println(fluxRecord.getField()); // System.out.println(fluxRecord.getField());
System.out.println(fluxRecord.getField() + " ->" + fluxRecord.getValueByKey("_value"));
} }
System.out.println("------------------------------------------");
} }
influxDBClient.close(); influxDBClient.close();
} }
@ -140,16 +137,13 @@ public class influxdb2Test {
"|> filter(fn: (r) => r[\"outlookId\"] == \"38\")" + "|> filter(fn: (r) => r[\"outlookId\"] == \"38\")" +
"|> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")"; "|> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")";
QueryApi queryApi = influxDBClient.getQueryApi(); QueryApi queryApi = influxDBClient.getQueryApi();
System.out.println(System.currentTimeMillis());
List<OutlookLog> tables = queryApi.query(flux, org, OutlookLog.class); List<OutlookLog> tables = queryApi.query(flux, org, OutlookLog.class);
System.out.println(System.currentTimeMillis());
for (OutlookLog table : tables) { for (OutlookLog table : tables) {
if (table.getMsg() == null) { if (table.getMsg() == null) {
continue; continue;
} }
// System.out.println(table); // System.out.println(table);
} }
System.out.println("tables 大小:" + tables.size());
influxDBClient.close(); influxDBClient.close();
} }
@ -163,11 +157,9 @@ public class influxdb2Test {
QueryApi queryApi = influxDBClient.getQueryApi(); QueryApi queryApi = influxDBClient.getQueryApi();
queryApi.query(flux, org, OutlookLog.class, (cancellable, outlookLog) -> { queryApi.query(flux, org, OutlookLog.class, (cancellable, outlookLog) -> {
if (outlookLog.getMsg() != null) { if (outlookLog.getMsg() != null) {
System.out.println(outlookLog);
} }
}); });
System.out.println("查询完成");
Thread.sleep(5_000); Thread.sleep(5_000);
influxDBClient.close(); influxDBClient.close();
} }