Skip to content

Commit

Permalink
[fix] 디스코드 로깅 오류 해결 (#128)
Browse files Browse the repository at this point in the history
* [fix] #127 add replaceAll in DiscordAppender to avoid invalid Json error

* [fix] #127 add replaceAll in DiscordAppender to avoid invalid Json error

* [fix] #127 testCommit
  • Loading branch information
tkdwns414 authored Sep 4, 2024
1 parent c42febc commit 2c65fc3
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ private static Color getLevelColor(ILoggingEvent eventObject) {
} else if (level.equals("ERROR")) {
return Color.red;
}

return Color.blue;
}

Expand All @@ -46,14 +45,13 @@ protected void append(ILoggingEvent eventObject) {

String level = eventObject.getLevel().levelStr;
String exceptionBrief = "";
String exceptionDetail = "";
IThrowableProxy throwable = eventObject.getThrowableProxy();

if (throwable != null) {
exceptionBrief = throwable.getClassName() + ": " + throwable.getMessage();
exceptionBrief = throwable.getClassName() + ": " + throwable.getMessage().replaceAll("\"", "'");
}

if (exceptionBrief.equals("")) {
if (exceptionBrief.isEmpty()) {
exceptionBrief = "EXCEPTION 정보가 남지 않았습니다.";
}

Expand Down Expand Up @@ -99,7 +97,7 @@ protected void append(ILoggingEvent eventObject) {
);

if (throwable != null) {
exceptionDetail = ThrowableProxyUtil.asString(throwable);
String exceptionDetail = ThrowableProxyUtil.asString(throwable);
String exception = exceptionDetail.substring(0, 4000);
discordWebhook.addEmbed(
new EmbedObject()
Expand Down

0 comments on commit 2c65fc3

Please sign in to comment.