upgrade log throwable - #74
Merged
Merged
Conversation
upgrade the log throwable
upgrade the logstream create count
upgrade the logstream create count
Codecov Report
@@ Coverage Diff @@
## master #74 +/- ##
============================================
- Coverage 33.92% 33.14% -0.79%
+ Complexity 70 69 -1
============================================
Files 25 25
Lines 731 706 -25
Branches 74 69 -5
============================================
- Hits 248 234 -14
+ Misses 468 458 -10
+ Partials 15 14 -1
Continue to review full report at Codecov.
|
kevinten10
requested changes
Dec 21, 2021
| } | ||
| } | ||
| } catch (Throwable throwable) { | ||
| throwable.printStackTrace(); |
Member
There was a problem hiding this comment.
can you explain the usage here
| private static void putLogToCloudWatch(String message, Map<String, String> tags) { | ||
| if (LogConfiguration.containsKey(CLOUD_WATCH_AGENT_SWITCH_NAME) | ||
| && Boolean.TRUE.toString().equalsIgnoreCase(LogConfiguration.get(CLOUD_WATCH_AGENT_SWITCH_NAME))) { | ||
| //put logs by agent |
| if (message != null) { | ||
| pw.println(message); | ||
| } | ||
| throwable.printStackTrace(pw); |
Member
There was a problem hiding this comment.
能否把printStackTrace这种用法统一包装起来,这样后续也好替换
Contributor
Author
There was a problem hiding this comment.
可以考虑像这种异常日志使用一套规范去打印,如日志信息里面加上日志错误级别。
| if(StringUtils.isNotBlank(appId)){ | ||
| defaultTags.put(APP_ID_NAME, appId); | ||
| } | ||
| }catch (Throwable e){ |
Contributor
Author
There was a problem hiding this comment.
这里只是增强的加一下tag,不强依赖这些tag,如果如appId获取失败不会导致整个日志输出失败。
| collectedMetrics.forEach(CloudWatchMetricsExporter::convertAndSend); | ||
| collectedMetrics.forEach(CloudWatchMetricsExporter::convertAndSend); | ||
| } catch (Throwable e) { | ||
| log.warn("Fail to export metrics.", e); |
Member
There was a problem hiding this comment.
中间件内部的异常日志,最好统一加个前缀,例如:[Capa.Log]
Resolve recursive dependency in log appender.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
upgrade log throwable
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: