Skip to content

Commit a06cdb9

Browse files
author
songjialin
committed
gradle重构
1 parent f95f55e commit a06cdb9

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.github.yungyu16.intellij.sqllogparser.logline;
2+
3+
import com.google.common.base.Charsets;
4+
import com.google.common.collect.Lists;
5+
import com.intellij.openapi.util.io.StreamUtil;
6+
import org.junit.Test;
7+
8+
import java.io.IOException;
9+
import java.io.InputStream;
10+
import java.util.ArrayList;
11+
import java.util.regex.Matcher;
12+
import java.util.regex.Pattern;
13+
14+
/**
15+
* CreatedDate: 2020/11/6
16+
* Author: songjialin
17+
*/
18+
public class LogLineParserTest {
19+
20+
@Test
21+
public void parse() throws IOException {
22+
InputStream input = LogLineParserTest.class.getResourceAsStream("/sqllog.txt");
23+
String log = StreamUtil.readText(input, Charsets.UTF_8);
24+
String result = LogLineParser.parse(log);
25+
System.out.println(result);
26+
}
27+
28+
@Test
29+
public void regex() {
30+
Pattern p = Pattern.compile("cat");
31+
Matcher m = p.matcher("one cat two cats in the yard");
32+
StringBuffer sb = new StringBuffer();
33+
while (m.find()) {
34+
m.appendReplacement(sb, "dog");
35+
}
36+
m.appendTail(sb);
37+
System.out.println(sb.toString());
38+
ArrayList<String> params = Lists.newArrayList("(Integer)");
39+
params.add("1(Integer)");
40+
params.add("2020-10-30 18:09:00.058(Timestamp)");
41+
params.forEach(it -> {
42+
System.out.println("》》》》》" + it);
43+
Matcher matcher = LogLineParser.PARAMETER_PATTERN.matcher(it);
44+
System.out.println(matcher.matches());
45+
try {
46+
System.out.println(matcher.group(0));
47+
System.out.println(matcher.group(1));
48+
System.out.println(matcher.group(2));
49+
} catch (Exception e) {
50+
e.printStackTrace();
51+
}
52+
System.out.println("---------");
53+
});
54+
}
55+
}

src/test/resources/sqllog.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[202011061409489faae40dced34e5699da102af0de975f] 开始进行登录后处理...
2+
2020-11-06 14:09:48:265 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.ChannelInfoRepository.selectOne-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Preparing: SELECT id,is_deleted,created_time,updated_time,remark,channel_code,channel_name,channel_type,app_key,app_secret FROM t_channel_info WHERE id = ? AND is_deleted = ?
3+
2020-11-06 14:09:48:265 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.ChannelInfoRepository.selectOne-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Parameters: 4(Integer), false(Boolean)
4+
2020-11-06 14:09:48:269 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.ChannelInfoRepository.selectOne-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Total: 1
5+
2020-11-06 14:09:48:269 INFO [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.service.etc.impl.LoginPostProcessorImpl-67 accId[*] [202011061409489faae40dced34e5699da102af0de975f] 当前渠道不需要登录后处理...
6+
2020-11-06 14:09:48:279 INFO [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.listener.spring.UserOperationListener-40 accId[*] [202011061409489faae40dced34e5699da102af0de975f] 收到用户操作事件
7+
2020-11-06 14:09:48:279 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginAccountRepository.updateByPrimaryKeySelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Preparing: UPDATE t_login_account SET id = id,device_id = ? WHERE id = ?
8+
2020-11-06 14:09:48:280 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginAccountRepository.updateByPrimaryKeySelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Parameters: 868453033084718(String), 1953(Integer)
9+
2020-11-06 14:09:48:290 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginAccountRepository.updateByPrimaryKeySelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Updates: 1
10+
2020-11-06 14:09:48:290 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginHistoryRepository.insertSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Preparing: INSERT INTO t_login_history ( id,is_deleted,created_time,updated_time,remark,account_id,client_type,device_id,request_ip,user_agent,client_version,client_catalog ) VALUES( ?,?,?,?,?,?,?,?,?,?,?,? )
11+
2020-11-06 14:09:48:291 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginHistoryRepository.insertSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Parameters: null, false(Boolean), 2020-11-06 14:09:48.29(Timestamp), 2020-11-06 14:09:48.29(Timestamp), LOGIN(String), 1953(Integer), ANDROID(String), 868453033084718(String), 58.33.140.218(String), Mozilla/5.0 (Linux; Android 9; vivo X21 Build/PKQ1.180819.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36(String), 3.1.5(String), 2(Integer)
12+
2020-11-06 14:09:48:294 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.selectOne-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Preparing: SELECT id,is_deleted,created_time,updated_time,remark,account_id,client_type,vcredit_id,vcredit_score FROM t_device_vcredit_info WHERE is_deleted = ? AND account_id = ? AND client_type = ? AND vcredit_id = ?
13+
2020-11-06 14:09:48:294 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.selectOne-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Parameters: false(Boolean), 1953(Integer), ANDROID(String), 2020110614024988a066fcdc5f4c7cac65a0e939a6f0ad002438cb1c83bad4(String)
14+
2020-11-06 14:09:48:298 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.selectOne-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Total: 0
15+
2020-11-06 14:09:48:299 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginHistoryRepository.insertSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Updates: 1
16+
2020-11-06 14:09:48:299 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginHistoryRepository.insertSelective!selectKey-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Executing: SELECT LAST_INSERT_ID()
17+
2020-11-06 14:09:48:299 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.updateByExampleSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Preparing: UPDATE t_device_vcredit_info SET id = id,is_deleted = ?,updated_time = ? WHERE ( account_id = ? and is_deleted = ? )
18+
2020-11-06 14:09:48:300 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.updateByExampleSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Parameters: true(Boolean), 2020-11-06 14:09:48.299(Timestamp), 1953(Integer), false(Boolean)
19+
2020-11-06 14:09:48:302 DEBUG [t: biz-scheduler-6] cn.xiaoshidai.web.app.boot.dao.repository.LoginHistoryRepository.insertSelective!selectKey-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Total: 1
20+
2020-11-06 14:09:48:306 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.updateByExampleSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Updates: 0
21+
2020-11-06 14:09:48:307 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.insertSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Preparing: INSERT INTO t_device_vcredit_info ( id,is_deleted,created_time,updated_time,remark,account_id,client_type,vcredit_id ) VALUES( ?,?,?,?,?,?,?,? )
22+
2020-11-06 14:09:48:308 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.insertSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Parameters: null, false(Boolean), 2020-11-06 14:09:48.307(Timestamp), 2020-11-06 14:09:48.307(Timestamp), (String), 1953(Integer), ANDROID(String), 2020110614024988a066fcdc5f4c7cac65a0e939a6f0ad002438cb1c83bad4(String)
23+
2020-11-06 14:09:48:315 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.insertSelective-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Updates: 1
24+
2020-11-06 14:09:48:315 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.insertSelective!selectKey-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] ==> Executing: SELECT LAST_INSERT_ID()
25+
2020-11-06 14:09:48:319 DEBUG [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.dao.repository.DeviceVcreditInfoRepository.insertSelective!selectKey-159 accId[*] [202011061409489faae40dced34e5699da102af0de975f] <== Total: 1
26+
2020-11-06 14:09:48:330 INFO [t: http-nio-8083-exec-1] cn.xiaoshidai.web.app.boot.aspect.RequestLogAspect-81 accId[*] [202011061409489faae40dced34e5699da102af0de975f] 响应内容:{}

0 commit comments

Comments
 (0)