Skip to content

Commit 5c17dfd

Browse files
committed
[Logging] Enable file logging with sensible defaults, but allow user to opt out
1 parent cb4b494 commit 5c17dfd

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ out/
4545
application-local.yml
4646
application-seedbox.yml
4747
docker-compose.yml
48+
logs

README.md

+13-28
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
### Inspiration
88

99
This application is heavily inspired by [Maintainerr](https://github.com/jorenn92/Maintainerr).
10-
If you're within the Plex ecosystem, want an easy to use GUI and more sophisticated functionality, you're better off
11-
using it instead.
10+
If you're within the Plex ecosystem, want an easy to use GUI and more sophisticated functionality, you're better off using it instead.
1211

1312
### Warning
1413

@@ -17,18 +16,16 @@ You may enable dry-run mode. This is enabled in the config template by default.
1716
Unless you disable dry-run mode, nothing will be deleted.
1817

1918
You may check the container logs for Janitorr to observe what the application would do, were you to turn off dry-run
20-
mode.
21-
If you don't manage your container via a GUI like portainer, try `docker logs janitorr`.
19+
mode. Janitorr logs to stdout, so you can view your logs in Docker. It is recommended to enable file logging in your config.
20+
Make sure `/logs` is mapped into the container, so that Janitorr can write log files to the host and not inside the container.
2221

2322
If you still don't trust Janitorr, you may enable Recycle Bin in the *arrs and disable Jellyfin/Emby.
2423
This way, no deletes will be triggered on Jellyfin and everthing triggered in the *arrs will only go to the Recycle Bin.
2524

26-
To enable debug logging, add the following lines at the top of your `application.yml`:
25+
To enable debug logging, change `INFO` following line in `application.yml` to either `DEBUG` or `TRACE`:
2726

2827
```yml
29-
logging:
30-
level:
31-
com.github.schaka: TRACE
28+
com.github.schaka: INFO
3229
```
3330
3431
### Introduction
@@ -39,7 +36,7 @@ logging:
3936
- Do you have a lot of media that never gets watched?
4037
- Do your users constantly request media, and let it sit there afterward never to be touched again?
4138
42-
You NEED [Maintainerr for Plex](https://github.com/jorenn92/Maintainerr) or Janitorr for Jellyfin and Emby.
39+
You Janitorr for Jellyfin and Emby.
4340
It's THE solution for cleaning up your server and freeing up space before you run into issues.
4441
4542
## Features
@@ -53,32 +50,17 @@ It's THE solution for cleaning up your server and freeing up space before you ru
5350
- Season by season removal for TV shows, or optionally the entire show
5451
- Clear requests from Jellyseerr and clean up leftover metadata in Jellyfin so no orphaned files are left
5552
56-
### Disclaimer
53+
### Important notes
5754
5855
- **I don't use Emby. I implemented and tested it, but for maintenance I rely on bug reports**
56+
- Only one of Jellyfin or Emby can be enabled at a time
5957
- "Leaving Soon" Collections are *always* created and do not care for dry-run settings
6058
- Jellyfin and Emby require user access to delete files, an API key is not enough - I recommend creating a user specifically for this task
61-
- Jellyfin does NOT provide viewing stats like Plex, so we go by file age in the *arrs - unless you provide access to JellyStat
6259
- Jellyfin/Emby and Jellyseerr are not required, but if you don't supply them, you may end up with orphaned folders, metadata, etc
63-
- Only one of Jellyfin or Emby can be enabled at a time
64-
- **If file system access isn't given, files currently still seeding may be deleted by the Sonarr/Radarr**
6560
6661
### Troubleshooting
6762
Before you create a new issue, please check previous issues to make sure nobody has faced the same problem before.
68-
The Wiki also contains a troubleshooting section with commons errors.
69-
70-
### Note to developers
71-
72-
I currently have to load pretty much the entire library in one REST call to manually match media. While both Jellyfin and Emby have
73-
some (different) filters for your library's content,
74-
I found both of them to be pretty wonky at best. Some parameters seemed to do nothing, others weren't marked as required
75-
when they were or results were unpredictable when an invalid value was supplied.
76-
This is also one area where Jellyfin and Emby tend to be quite different.
77-
78-
For those more familiar with Java/Kotlin, GraalVM and Spring:
79-
The reason the code looks a little messy and doesn't let Spring's magic run wild with `@ConditonalOnProperty` is because native images don't support this (yet).
80-
Proxies are very limited and creating a `@Bean` inside a `@Config` doesn't produce working proxies for things like `@PostConstruct` and `@Cacheable` half the time.
81-
AOT also doesn't work exactly the same as native image deployment and thus is a lot harder to debug.
63+
[The Wiki](https://github.com/Schaka/janitorr/wiki) also contains a troubleshooting section with commons errors.
8264
8365
## Setup
8466
@@ -126,6 +108,7 @@ media-server-leaving-soon-dir: "/library/leaving-soon"
126108
Before using this, please make sure you've created the `application.yml` file and put it in the correct config directory you intend to map.
127109
The application requires it. You need to supply it, or Janitorr will not start correctly.
128110
You don't have to publish ANY ports on the host machine.
111+
If you're seeing any problems, consult [the Wiki](https://github.com/Schaka/janitorr/wiki/Troubleshooting).
129112

130113
An example of a `docker-compose.yml` may look like this:
131114

@@ -139,6 +122,7 @@ services:
139122
user: 1000:1000 # Replace with your user who should own your application.yml file
140123
volumes:
141124
- /appdata/janitorr/config/application.yml:/workspace/application.yml
125+
- /appdata/janitorr/logs:/logs
142126
- /share_media:/data
143127
healthcheck:
144128
test: "wget -T5 -qO- http://localhost:8081/health | grep UP || exit 1"
@@ -150,7 +134,7 @@ services:
150134
A native image is also published for every build. It keeps a much lower memory and CPU footprint and doesn't require longer runtimes to achieve optimal performance (JIT).
151135
If you restart more often than once a week or have a very low powered server, this is now recommended.
152136
That image is always tagged `:native-stable`. To get a specific version, use `:native-v1.x.x`.
153-
While I do publish an arm64 version of this image, it is mostly untested.
137+
**While I do publish an arm64 version of this image, it is mostly untested.**
154138
The healthcheck also work slightly differently, see below:
155139

156140
```yml
@@ -163,6 +147,7 @@ services:
163147
user: 1000:1000 # Replace with your user who should own your application.yml file
164148
volumes:
165149
- /appdata/janitorr/config/application.yml:/workspace/application.yml
150+
- /appdata/janitorr/logs:/logs
166151
- /share_media:/data
167152
environment:
168153
# Uses https://github.com/dmikusa/tiny-health-checker supplied by paketo buildpacks

src/main/resources/application-template.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
server:
22
port: 8978
33

4+
logging:
5+
level:
6+
com.github.schaka: INFO # Set to debug or trace to get more info about what Janitorr is doing
7+
threshold:
8+
file: NONE # Set to TRACE to enable file logging
9+
410
# File system access (same mapping as Sonarr, Radarr and Jellyfin) is required to delete TV shows by season and create "Leaving Soon" collections in Jellyfin
511
# Currently, Jellyfin does not support an easy way to add only a few seasons or movies to a collection, we need access to temporary symlinks
612
# Additionally, checks to prevent deletion on currently still seeding media currently require file system access as well

src/main/resources/application.yml

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ spring:
88
virtual:
99
enabled: true
1010

11+
logging:
12+
file:
13+
path: "/logs"
14+
name: "/logs/janitorr.log"
15+
logback:
16+
rollingpolicy:
17+
max-history: 14
18+
max-file-size: 100MB
19+
clean-history-on-start: true
20+
threshold:
21+
file: NONE
22+
1123
management:
1224
server:
1325
port: 8081

0 commit comments

Comments
 (0)