Skip to content

Commit

Permalink
Log exceptions when they are thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
shayaantx committed Dec 14, 2023
1 parent ab7b342 commit cd31512
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/botdarr/api/ArrRequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private RequestBuilder tokens(RequestBuilder requestBuilder) {
.headers("X-Api-Key", Config.getProperty(this.tokenName));
}

private String getRadarrHost() {
private String getHost() {
String host = Config.getProperty(this.urlConfigName);
String rawUrlBase = Config.getProperty(this.urlBaseConfigName);
String urlBase = Strings.isBlank(rawUrlBase) ? "" : "/" + rawUrlBase;
Expand All @@ -43,12 +43,12 @@ public RequestBuilder buildGet(String path, Map<String, String> params) {
for (Map.Entry<String, String> entry : params.entrySet()) {
this.requestBuilder.param(entry.getKey(), entry.getValue());
}
RequestBuilder requestBuilder = this.requestBuilder.host(getRadarrHost() + path);
RequestBuilder requestBuilder = this.requestBuilder.host(getHost() + path);
return this.tokens(requestBuilder);
}

public RequestBuilder buildPost(String path, String postBody) {
RequestBuilder requestBuilder = this.requestBuilder.host(getRadarrHost() + path).post(postBody);
RequestBuilder requestBuilder = this.requestBuilder.host(getHost() + path).post(postBody);
return this.tokens(requestBuilder);
}
}
20 changes: 10 additions & 10 deletions src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<Appenders>
<!-- Console Appender -->
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n" />
<PatternLayout pattern="%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable" />
</Console>
<RollingFile name="BotLog">
<FileName>logs/bot.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -21,7 +21,7 @@
<FileName>logs/audit.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.audit.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -33,7 +33,7 @@
<FileName>logs/radarr.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -45,7 +45,7 @@
<FileName>logs/sonarr.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -57,7 +57,7 @@
<FileName>logs/network.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -69,7 +69,7 @@
<FileName>logs/slack.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -81,7 +81,7 @@
<FileName>logs/discord.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -93,7 +93,7 @@
<FileName>logs/matrix.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand All @@ -105,7 +105,7 @@
<FileName>logs/telegram.log</FileName>
<FilePattern>logs/%d{yyyy-MM-dd-hh-mm}.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n</Pattern>
<Pattern>%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %scrubbedMsg%n%throwable</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB"/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.6.10
5.6.11

0 comments on commit cd31512

Please sign in to comment.