Skip to content

Commit

Permalink
https://github.com/uavorg/uavstack/issues/147
Browse files Browse the repository at this point in the history
FIX
Issue#127时将日志画像路径转为绝对路径存储日志过滤规则,由于windows路径分隔符与linux不同,影响了windows的日志过滤规则的匹配,导致无法归集日志
修改:
1.日志过滤规则在put时已经转为依赖平台的绝对路径,get日志过滤规则时不需要再转换windows的日志路径分隔符,遂注释掉。
2.统一logcollection和aidlogcollection在put和get时的路径分隔符转换。
  • Loading branch information
fyb007 committed Jan 5, 2018
1 parent ae7e986 commit 4209b44
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ public LogFilterAndRuleBuilder newBuilder() {

protected List<LogFilterAndRule> getAidLogFilterAndRuleList(String id) {

id = id.replace('\\', '/');
// id = id.replace('\\', '/');
return aidlogcollection.getIfPresent(id);
}

// this key should be absFilePath --- by hongqiang
public LogFilterAndRule getLogFilterAndRule(String id) {

id = id.replace('\\', '/');
// id = id.replace('\\', '/');
LogFilterAndRule lfar = null;

lfar = logcollection.getIfPresent(id);
Expand Down Expand Up @@ -275,9 +275,10 @@ public LogFilterAndRule build(String classname) {
AppLogPatternInfoCollection profileMap = logAgent.getLatestLogProfileDataMap();
LogPatternInfo logPatternInfo = profileMap.get(serverid + "-" + appid,
serverid + "-" + appid + "-" + logid);
logcollection.put(logPatternInfo.getAbsolutePath(), mainLogFAR);
if (aidLogFARlist != null)
aidlogcollection.put(logPatternInfo.getAbsolutePath(), aidLogFARlist);
pubLogFilterAndRule(logPatternInfo.getAbsolutePath(), mainLogFAR);
if (aidLogFARlist != null) {
pubAidLogFilterAndRule(logPatternInfo.getAbsolutePath(), aidLogFARlist);
}
return mainLogFAR;
}

Expand Down Expand Up @@ -382,6 +383,14 @@ public void pubLogFilterAndRule(String id, LogFilterAndRule lfar) {
logcollection.put(id, lfar);
}

public void pubAidLogFilterAndRule(String id, List<LogFilterAndRule> lfar) {

// 保证路径不存在多余的'/'等
id = new File(id).getAbsolutePath();

aidlogcollection.put(id, lfar);
}

public boolean hasLogFilterAndRule(String id) {

LogFilterAndRule lfar = logcollection.getIfPresent(id);
Expand Down

0 comments on commit 4209b44

Please sign in to comment.