diff --git a/deploy/releases-repo/README.md b/deploy/releases-repo/README.md
index 469fb8db..443602dc 100644
--- a/deploy/releases-repo/README.md
+++ b/deploy/releases-repo/README.md
@@ -91,7 +91,10 @@ admin panel shows under Settings so you can compare them.
continues in `.1.log`, `.2.log`… at 50 MB (`CHRONOS_LOG_MAX_FILE_MB`), files are kept 14 days
(`CHRONOS_LOG_RETENTION_DAYS`) and the oldest go when all of them pass 1024 MB (`CHRONOS_LOG_MAX_TOTAL_MB`; 0: no
limit). `CHRONOS_LOG_LEVEL` sets the level of the files and the console, `CHRONOS_LOG_CONSOLE_LEVEL` the console's
- alone. Without these variables the admin panel changes them in Settings › Logs while the server runs.
+ alone. Without these variables the admin panel changes them in Settings › Logs while the server runs; a field a
+ variable fixes is read-only there, and its tooltip names the variable. The compose file and Unraid template of earlier
+ versions set `CHRONOS_LOG_LEVEL: Information`, which now fixes both levels: remove it (compose: delete the line;
+ Unraid: edit the container and clear *Log level*) to choose them in the panel.
- Other host ports: when you publish the container's ports as other host ports (`18443:8443`), set
`CHRONOS_PUBLIC_HTTPS_PORT` (and `CHRONOS_PUBLIC_HTTP_PORT`) to the host ports, so the admin panel's redirect to HTTPS
and LAN discovery name the ports clients can reach.
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 4eb315cc..7c5c21be 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -74,7 +74,7 @@ Dependencies point one way: `Core` ← `Core.Windows`, `Data`, `Protocol` ← `S
| `Archive` | `CurrentArchive`, `ArchiveTree`, figures for the charts, maintenance reports, mass rename and move, delete and trash dialogs (`SequenceDeletion`, `DeletePlans`), `ArchiveFailures` |
| `Server` | `ServerSession`, `ConnectFlow` (trust on first use), `SyncHost` (sync engine, agent, metered hold, editor connections, Export Sync), sync table, `RemoteSequenceApi` |
| `Jobs`, `Settings`, `About` | Job list and buffering, `JobNotices` (which job endings raise a toast; `JobEndings` lets a batch speak once); the schedules of Jobs › Scheduled (`DesktopScheduleHost`: the desktop's `IScheduleHost` and its system schedules `archive-scan`, `index-backup`, `housekeeping`; `CacheTrimStep`, the host's clean-up step; `SchedulesViewModel`, `ScheduleRowViewModel`, `ScheduleEditorViewModel` and `ScheduleDialogs.xaml`, the in-window editor; `ScheduleText`); settings rows (`LogSettingsRows`: Advanced's log rows), encoder and format inventories, `ProcessingTuning` (Settings › Rendering and Analysis applied to each job: parallelism, memory budget, quality), `InterfacePriority`, language catalog, naming preview; `AboutViewModel` (owned by the shell, not a section: Settings › About, the update notice of Settings › Updates and the update check on start), update check and download |
-| `Infrastructure` | `AppServices` (composition root), `AppSettings`, `AppLogging` (Settings › Advanced › Logs applied to the log files at start and at every save), `AppEnvironment` (installed or portable), `AppClock` (today's date, frozen by `--capture`), `StartWithWindows` (this copy's sign-in entry), `UiLanguage`, `LiveRegion`, `RenderNodeHost`, `DiagnosticsBundle`, `ShellActions` (BRIEF §8.6), `SingleInstance` (one Chronos per data folder; a later launch hands its file over a named pipe, or waits for a closing one to exit and starts in its place), device monitor |
+| `Infrastructure` | `AppServices` (composition root), `AppSettings`, `AppLogging` (Settings › Advanced › Logs applied to the log files from their first line, a launch that only hands over included, and at every save), `AppEnvironment` (installed or portable), `AppClock` (today's date, frozen by `--capture`), `StartWithWindows` (this copy's sign-in entry), `UiLanguage`, `LiveRegion`, `RenderNodeHost`, `DiagnosticsBundle`, `ShellActions` (BRIEF §8.6), `SingleInstance` (one Chronos per data folder; a later launch hands its file over a named pipe, or waits for a closing one to exit and starts in its place), device monitor |
| `DesignTime` | `SampleData`: the archive, jobs and server the screenshots and smoke tests run on, dated from the fixed `SampleData.Now` |
### 2.4 Chronos.Ui and Chronos.Server
diff --git a/i18n/ar/Admin.ar.resx b/i18n/ar/Admin.ar.resx
index aab4deaf..d40c5ff2 100644
--- a/i18n/ar/Admin.ar.resx
+++ b/i18n/ar/Admin.ar.resx
@@ -314,7 +314,6 @@
اللغةلغة رسائل الخادم عندما لا يطلب العميل لغة معينةالحدود والاحتفاظ
- يعيّنه متغير البيئة {0}أقصى حجم للملف (ميغابايت)أكبر حجم مقبول للملف الواحد المرفوعالشبكة وبروتوكول TLS
diff --git a/i18n/bg/Admin.bg.resx b/i18n/bg/Admin.bg.resx
index 4412a2b1..eec2eebe 100644
--- a/i18n/bg/Admin.bg.resx
+++ b/i18n/bg/Admin.bg.resx
@@ -288,7 +288,6 @@
ЕзикЕзик на съобщенията на сървъра, когато клиентът не е поискал конкретен езикОграничения и съхранение
- Зададено от променливата на средата {0}Макс. файл (МБ)Най-голямото приемано единично качванеМрежа и TLS
diff --git a/i18n/cs/Admin.cs.resx b/i18n/cs/Admin.cs.resx
index c546b710..bedcecb9 100644
--- a/i18n/cs/Admin.cs.resx
+++ b/i18n/cs/Admin.cs.resx
@@ -301,7 +301,6 @@
JazykJazyk zpráv serveru, pokud klient žádný nevyžadujeLimity a uchovávání
- Nastaveno proměnnou prostředí {0}Max. soubor (MB)Největší přijatý jednotlivý soubor při nahráváníSíť a TLS
diff --git a/i18n/da/Admin.da.resx b/i18n/da/Admin.da.resx
index 121cd783..e36debd2 100644
--- a/i18n/da/Admin.da.resx
+++ b/i18n/da/Admin.da.resx
@@ -288,7 +288,6 @@
SprogSproget i servermeddelelser, når en klient ikke beder om et bestemt sprogGrænser og opbevaring
- Angivet af miljøvariablen {0}Maks. fil (MB)Den største enkeltupload, der accepteresNetværk og TLS
diff --git a/i18n/de/Admin.de.resx b/i18n/de/Admin.de.resx
index 9e215316..630d3102 100644
--- a/i18n/de/Admin.de.resx
+++ b/i18n/de/Admin.de.resx
@@ -288,7 +288,6 @@
SpracheSprache der Servermeldungen, wenn ein Client keine angibtLimits und Aufbewahrung
- Durch die Umgebungsvariable {0} festgelegtMax. Datei (MB)Größter angenommener Einzel-UploadNetzwerk und TLS
diff --git a/i18n/el/Admin.el.resx b/i18n/el/Admin.el.resx
index 15378d42..3ad9afc0 100644
--- a/i18n/el/Admin.el.resx
+++ b/i18n/el/Admin.el.resx
@@ -288,7 +288,6 @@
ΓλώσσαΓλώσσα των μηνυμάτων του διακομιστή όταν ένα πρόγραμμα-πελάτης δεν ζητά καμίαΌρια και διατήρηση
- Ορίζεται από τη μεταβλητή περιβάλλοντος {0}Μέγ. αρχείο (MB)Το μεγαλύτερο μεμονωμένο αρχείο που γίνεται δεκτό σε μια αποστολήΔίκτυο και TLS
diff --git a/i18n/en/Admin.resx b/i18n/en/Admin.resx
index 1c3b48b9..538ca6fd 100644
--- a/i18n/en/Admin.resx
+++ b/i18n/en/Admin.resx
@@ -461,8 +461,7 @@
TraceWarningLimits and retention
- Set by the environment variable {0}
- Set by the environment variable {0} or {1}
+ Set by the environment variable {0}; remove the variable to change it hereFile levelLeast severe level written to the log files; Debug and Trace help find problems but fill the files fastFile size (MB)
diff --git a/i18n/es/Admin.es.resx b/i18n/es/Admin.es.resx
index cf1b0c10..5b0aa399 100644
--- a/i18n/es/Admin.es.resx
+++ b/i18n/es/Admin.es.resx
@@ -288,7 +288,6 @@
IdiomaIdioma de los mensajes del servidor cuando un cliente no pide ningunoLímites y retención
- Definido por la variable de entorno {0}Archivo máx. (MB)Tamaño máximo aceptado para una sola subidaRed y TLS
diff --git a/i18n/et/Admin.et.resx b/i18n/et/Admin.et.resx
index 0033c3d5..fb37bee6 100644
--- a/i18n/et/Admin.et.resx
+++ b/i18n/et/Admin.et.resx
@@ -288,7 +288,6 @@
KeelServeri teadete keel, kui klient keelt ei määraPiirangud ja säilitamine
- Määratud keskkonnamuutujaga {0}Maks. fail (MB)Suurim vastuvõetav üksikfailVõrk ja TLS
diff --git a/i18n/fi/Admin.fi.resx b/i18n/fi/Admin.fi.resx
index 41116b98..42d6a29a 100644
--- a/i18n/fi/Admin.fi.resx
+++ b/i18n/fi/Admin.fi.resx
@@ -288,7 +288,6 @@
KieliPalvelimen viestien kieli, kun asiakasohjelma ei pyydä mitään kieltäRajat ja säilytys
- Asetettu ympäristömuuttujalla {0}Tiedosto enint. (Mt)Suurin hyväksytty yksittäinen lähetysVerkko ja TLS
diff --git a/i18n/fr/Admin.fr.resx b/i18n/fr/Admin.fr.resx
index c376dcaa..e92b41c3 100644
--- a/i18n/fr/Admin.fr.resx
+++ b/i18n/fr/Admin.fr.resx
@@ -288,7 +288,6 @@
LangueLangue des messages du serveur quand un client n'en demande aucuneLimites et conservation
- Défini par la variable d'environnement {0}Fichier max. (Mo)Taille maximale acceptée pour un seul envoiRéseau et TLS
diff --git a/i18n/he/Admin.he.resx b/i18n/he/Admin.he.resx
index 5949df79..e70d8ba2 100644
--- a/i18n/he/Admin.he.resx
+++ b/i18n/he/Admin.he.resx
@@ -301,7 +301,6 @@
שפהשפת ההודעות של השרת כאשר הלקוח אינו מבקש שפהמגבלות ושמירה
- נקבע על ידי משתנה הסביבה {0}קובץ מרבי (MB)הקובץ הגדול ביותר שמתקבל בהעלאה בודדתרשת ו-TLS
diff --git a/i18n/hi/Admin.hi.resx b/i18n/hi/Admin.hi.resx
index d1e31202..cdd72f4e 100644
--- a/i18n/hi/Admin.hi.resx
+++ b/i18n/hi/Admin.hi.resx
@@ -288,7 +288,6 @@
भाषाजब क्लाइंट कोई भाषा न माँगे, तब सर्वर संदेशों की भाषासीमाएँ और अवधारण
- परिवेश चर {0} द्वारा सेटअधिकतम फ़ाइल (MB)स्वीकार किया जाने वाला सबसे बड़ा एकल अपलोडनेटवर्क और TLS
diff --git a/i18n/hr/Admin.hr.resx b/i18n/hr/Admin.hr.resx
index 4ed85bf3..df3ae703 100644
--- a/i18n/hr/Admin.hr.resx
+++ b/i18n/hr/Admin.hr.resx
@@ -301,7 +301,6 @@
JezikJezik poruka poslužitelja kada klijent ne zatraži nijedanOgraničenja i čuvanje
- Vrijednost postavlja varijabla okruženja {0}Najveća datoteka (MB)Najveći prihvaćeni pojedinačni prijenosMreža i TLS
diff --git a/i18n/hu/Admin.hu.resx b/i18n/hu/Admin.hu.resx
index 514d4a18..952aaf30 100644
--- a/i18n/hu/Admin.hu.resx
+++ b/i18n/hu/Admin.hu.resx
@@ -288,7 +288,6 @@
NyelvA szerverüzenetek nyelve, ha a kliens nem kér konkrét nyelvetKorlátok és megőrzés
- A(z) {0} környezeti változó állítja beMax. fájlméret (MB)A legnagyobb elfogadott egyedi feltöltésHálózat és TLS
diff --git a/i18n/id/Admin.id.resx b/i18n/id/Admin.id.resx
index 3cf6613a..55619a0a 100644
--- a/i18n/id/Admin.id.resx
+++ b/i18n/id/Admin.id.resx
@@ -288,7 +288,6 @@
BahasaBahasa pesan server jika klien tidak meminta bahasa tertentuBatas dan retensi
- Diatur oleh variabel lingkungan {0}File maks. (MB)Ukuran unggahan tunggal terbesar yang diterimaJaringan dan TLS
diff --git a/i18n/it/Admin.it.resx b/i18n/it/Admin.it.resx
index 02b185ba..0bc945da 100644
--- a/i18n/it/Admin.it.resx
+++ b/i18n/it/Admin.it.resx
@@ -460,8 +460,7 @@
TraceAvvisoLimiti e conservazione
- Impostato dalla variabile d'ambiente {0}
- Impostato dalla variabile d'ambiente {0} o {1}
+ Impostato dalla variabile d'ambiente {0}; rimuovi la variabile per cambiarlo quiLivello fileLivello minimo scritto nei file di log; Debug e Trace aiutano a trovare i problemi ma riempiono i file in frettaDimensione file (MB)
diff --git a/i18n/ja/Admin.ja.resx b/i18n/ja/Admin.ja.resx
index b24f7622..9700bcee 100644
--- a/i18n/ja/Admin.ja.resx
+++ b/i18n/ja/Admin.ja.resx
@@ -288,7 +288,6 @@
言語クライアントが言語を指定しない場合のサーバーメッセージの言語です。制限と保持
- 環境変数 {0} で設定されています。最大ファイル (MB)1 回のアップロードで受け付ける最大サイズです。ネットワークと TLS
diff --git a/i18n/ko/Admin.ko.resx b/i18n/ko/Admin.ko.resx
index f3434c76..7b5b497a 100644
--- a/i18n/ko/Admin.ko.resx
+++ b/i18n/ko/Admin.ko.resx
@@ -288,7 +288,6 @@
언어클라이언트가 언어를 지정하지 않을 때 쓰는 서버 메시지 언어제한 및 보존
- 환경 변수 {0}에서 설정됨최대 파일(MB)허용되는 단일 업로드의 최대 크기네트워크 및 TLS
diff --git a/i18n/lt/Admin.lt.resx b/i18n/lt/Admin.lt.resx
index 7298e4db..b966b9ce 100644
--- a/i18n/lt/Admin.lt.resx
+++ b/i18n/lt/Admin.lt.resx
@@ -301,7 +301,6 @@
KalbaServerio pranešimų kalba, kai klientas jos nenurodoRibos ir saugojimas
- Nustatyta aplinkos kintamuoju {0}Didžiausias failas (MB)Didžiausias priimamo vieno įkeliamo failo dydisTinklas ir TLS
diff --git a/i18n/lv/Admin.lv.resx b/i18n/lv/Admin.lv.resx
index bdd991d1..c40a8a65 100644
--- a/i18n/lv/Admin.lv.resx
+++ b/i18n/lv/Admin.lv.resx
@@ -301,7 +301,6 @@
ValodaServera ziņojumu valoda, ja klients to nenorādaIerobežojumi un glabāšana
- Iestatīts ar vides mainīgo {0}Maks. fails (MB)Lielākais pieņemtais viena faila augšupielādes apjomsTīkls un TLS
diff --git a/i18n/ms/Admin.ms.resx b/i18n/ms/Admin.ms.resx
index 4bba11be..4ec8f6bc 100644
--- a/i18n/ms/Admin.ms.resx
+++ b/i18n/ms/Admin.ms.resx
@@ -288,7 +288,6 @@
BahasaBahasa mesej pelayan apabila klien tidak meminta sebarang bahasaHad dan pengekalan
- Ditetapkan oleh pemboleh ubah persekitaran {0}Fail maks (MB)Muat naik tunggal terbesar yang diterimaRangkaian dan TLS
diff --git a/i18n/nb/Admin.nb.resx b/i18n/nb/Admin.nb.resx
index cfd63c17..7429b2fb 100644
--- a/i18n/nb/Admin.nb.resx
+++ b/i18n/nb/Admin.nb.resx
@@ -288,7 +288,6 @@
SpråkSpråket i servermeldinger når en klient ikke ber om et bestemt språkGrenser og oppbevaring
- Angitt av miljøvariabelen {0}Maks. filstørrelse (MB)Største enkeltopplasting som godtasNettverk og TLS
diff --git a/i18n/nl/Admin.nl.resx b/i18n/nl/Admin.nl.resx
index 4fa190b4..93d00f9e 100644
--- a/i18n/nl/Admin.nl.resx
+++ b/i18n/nl/Admin.nl.resx
@@ -288,7 +288,6 @@
TaalTaal van serverberichten als een client er geen opgeeftLimieten en bewaartermijn
- Ingesteld door de omgevingsvariabele {0}Max. bestand (MB)Grootste afzonderlijke upload die wordt geaccepteerdNetwerk en TLS
diff --git a/i18n/pl/Admin.pl.resx b/i18n/pl/Admin.pl.resx
index 39017b14..cb2a7657 100644
--- a/i18n/pl/Admin.pl.resx
+++ b/i18n/pl/Admin.pl.resx
@@ -314,7 +314,6 @@
JęzykJęzyk komunikatów serwera, gdy klient nie wskaże żadnegoLimity i przechowywanie
- Ustawione przez zmienną środowiskową {0}Maks. rozmiar pliku (MB)Największy akceptowany rozmiar pojedynczego przesyłanego plikuSieć i TLS
diff --git a/i18n/pt-BR/Admin.pt-BR.resx b/i18n/pt-BR/Admin.pt-BR.resx
index 83c80034..478ff99b 100644
--- a/i18n/pt-BR/Admin.pt-BR.resx
+++ b/i18n/pt-BR/Admin.pt-BR.resx
@@ -288,7 +288,6 @@
IdiomaIdioma das mensagens do servidor quando o cliente não pede nenhumLimites e retenção
- Definido pela variável de ambiente {0}Arquivo máximo (MB)Maior envio individual aceitoRede e TLS
diff --git a/i18n/pt-PT/Admin.pt-PT.resx b/i18n/pt-PT/Admin.pt-PT.resx
index b8521416..f5a42f5e 100644
--- a/i18n/pt-PT/Admin.pt-PT.resx
+++ b/i18n/pt-PT/Admin.pt-PT.resx
@@ -288,7 +288,6 @@
IdiomaIdioma das mensagens do servidor quando um cliente não pede nenhumLimites e retenção
- Definido pela variável de ambiente {0}Ficheiro máx. (MB)Maior carregamento individual aceiteRede e TLS
diff --git a/i18n/ro/Admin.ro.resx b/i18n/ro/Admin.ro.resx
index a804cdfc..fa9ad08c 100644
--- a/i18n/ro/Admin.ro.resx
+++ b/i18n/ro/Admin.ro.resx
@@ -301,7 +301,6 @@
LimbăLimba mesajelor serverului atunci când clientul nu cere una anumeLimite și păstrare
- Setat prin variabila de mediu {0}Fișier maxim (MB)Cea mai mare încărcare individuală acceptatăRețea și TLS
diff --git a/i18n/ru/Admin.ru.resx b/i18n/ru/Admin.ru.resx
index c3fe9314..a47c9d38 100644
--- a/i18n/ru/Admin.ru.resx
+++ b/i18n/ru/Admin.ru.resx
@@ -314,7 +314,6 @@
ЯзыкЯзык сообщений сервера, если клиент не указал свойОграничения и хранение
- Задаётся переменной среды {0}Макс. размер файла (МБ)Наибольший размер одного принимаемого файлаСеть и TLS
diff --git a/i18n/sk/Admin.sk.resx b/i18n/sk/Admin.sk.resx
index 8185b2a7..8ec84b78 100644
--- a/i18n/sk/Admin.sk.resx
+++ b/i18n/sk/Admin.sk.resx
@@ -301,7 +301,6 @@
JazykJazyk správ servera, keď klient žiadny nepožadujeLimity a uchovávanie
- Nastavené premennou prostredia {0}Max. súbor (MB)Najväčší jednotlivý súbor, ktorý server pri nahrávaní prijmeSieť a TLS
diff --git a/i18n/sl/Admin.sl.resx b/i18n/sl/Admin.sl.resx
index c4ff8ff6..d99f1895 100644
--- a/i18n/sl/Admin.sl.resx
+++ b/i18n/sl/Admin.sl.resx
@@ -301,7 +301,6 @@
JezikJezik sporočil strežnika, kadar odjemalec ne zahteva nobenegaOmejitve in hramba
- Nastavljeno s spremenljivko okolja {0}Največja datoteka (MB)Največja sprejeta posamezna naložena datotekaOmrežje in TLS
diff --git a/i18n/sv/Admin.sv.resx b/i18n/sv/Admin.sv.resx
index ca0c916f..bf7f0dbf 100644
--- a/i18n/sv/Admin.sv.resx
+++ b/i18n/sv/Admin.sv.resx
@@ -288,7 +288,6 @@
SpråkSpråk för servermeddelanden när en klient inte begär någotGränser och lagringstid
- Anges av miljövariabeln {0}Största fil (MB)Största enskilda uppladdning som accepterasNätverk och TLS
diff --git a/i18n/th/Admin.th.resx b/i18n/th/Admin.th.resx
index 91bed582..6066ab43 100644
--- a/i18n/th/Admin.th.resx
+++ b/i18n/th/Admin.th.resx
@@ -288,7 +288,6 @@
ภาษาภาษาของข้อความจากเซิร์ฟเวอร์เมื่อไคลเอนต์ไม่ได้ระบุภาษาขีดจำกัดและการเก็บรักษา
- กำหนดโดยตัวแปรสภาพแวดล้อม {0}ไฟล์สูงสุด (MB)ขนาดสูงสุดของการอัปโหลดไฟล์เดียวที่ยอมรับเครือข่ายและ TLS
diff --git a/i18n/tr/Admin.tr.resx b/i18n/tr/Admin.tr.resx
index fd1cebae..11bcc313 100644
--- a/i18n/tr/Admin.tr.resx
+++ b/i18n/tr/Admin.tr.resx
@@ -288,7 +288,6 @@
Dilİstemci bir dil istemediğinde sunucu iletilerinin diliSınırlar ve saklama
- {0} ortam değişkeniyle ayarlanırEn büyük dosya (MB)Kabul edilen en büyük tekil yüklemeAğ ve TLS
diff --git a/i18n/uk/Admin.uk.resx b/i18n/uk/Admin.uk.resx
index 6e03fca4..99dbcbb5 100644
--- a/i18n/uk/Admin.uk.resx
+++ b/i18n/uk/Admin.uk.resx
@@ -314,7 +314,6 @@
МоваМова повідомлень сервера, якщо клієнт не вказав жодноїОбмеження та зберігання
- Задано змінною середовища {0}Макс. файл (МБ)Найбільший розмір одного вивантаженого файлу, який приймає серверМережа та TLS
diff --git a/i18n/vi/Admin.vi.resx b/i18n/vi/Admin.vi.resx
index 34ace583..6724f5c8 100644
--- a/i18n/vi/Admin.vi.resx
+++ b/i18n/vi/Admin.vi.resx
@@ -288,7 +288,6 @@
Ngôn ngữNgôn ngữ của thông báo máy chủ khi máy khách không yêu cầu ngôn ngữ nàoGiới hạn và lưu giữ
- Được đặt bởi biến môi trường {0}Tệp tối đa (MB)Kích thước lớn nhất được chấp nhận cho một tệp tải lênMạng và TLS
diff --git a/i18n/zh-Hans/Admin.zh-Hans.resx b/i18n/zh-Hans/Admin.zh-Hans.resx
index ad2c4431..3f35559c 100644
--- a/i18n/zh-Hans/Admin.zh-Hans.resx
+++ b/i18n/zh-Hans/Admin.zh-Hans.resx
@@ -288,7 +288,6 @@
语言客户端未指定语言时服务器消息使用的语言限制与保留
- 由环境变量 {0} 设置单文件上限(MB)可接受的单个上传文件的最大大小网络和 TLS
diff --git a/i18n/zh-Hant/Admin.zh-Hant.resx b/i18n/zh-Hant/Admin.zh-Hant.resx
index 980eed5a..7d7c4d6b 100644
--- a/i18n/zh-Hant/Admin.zh-Hant.resx
+++ b/i18n/zh-Hant/Admin.zh-Hant.resx
@@ -288,7 +288,6 @@
語言用戶端未指定語言時,伺服器訊息所使用的語言限制與保留
- 由環境變數 {0} 設定檔案上限(MB)可接受的單一上傳檔案大小上限網路與 TLS
diff --git a/src/Chronos.App/App.xaml.cs b/src/Chronos.App/App.xaml.cs
index 228dca7f..bd806fe2 100644
--- a/src/Chronos.App/App.xaml.cs
+++ b/src/Chronos.App/App.xaml.cs
@@ -41,7 +41,9 @@ public partial class App : Application
var capture = captureIndex >= 0;
// Capture never reads or writes the user's data folder.
Environment = capture ? AppEnvironment.ForCapture() : AppEnvironment.Detect();
- _log = new FileLogSink(Environment.LogDirectory, "chronos");
+ // Settings › Advanced › Logs from the first line, which prunes the folder: also a launch that only hands over. The
+ // settings are read again once this launch owns the data folder, since a Chronos that was closing saves them on exit.
+ _log = AppLogging.Open(Environment.LogDirectory, capture ? new AppSettings() : AppSettings.Load(Environment.SettingsPath));
// Capture runs in CI: mirror the log to stderr so failures are visible in the job output.
Log.SetSink(capture ? new TeeLogSink(_log, new StderrLogSink()) : _log);
Log.Info("app", $"Chronos {AppServices.VersionText} starting; data at {Environment.DataDirectory}");
diff --git a/src/Chronos.App/Infrastructure/AppLogging.cs b/src/Chronos.App/Infrastructure/AppLogging.cs
index 0185a875..8660b0bb 100644
--- a/src/Chronos.App/Infrastructure/AppLogging.cs
+++ b/src/Chronos.App/Infrastructure/AppLogging.cs
@@ -5,7 +5,8 @@ namespace Chronos.App.Infrastructure;
///
/// Settings › Advanced › Logs applied to this PC's log files (owner review 2, R11): the level, retention, size limits and
/// rotation of the App starts with, and the engine's (the files
-/// are the only output outside screenshots). Values outside the ranges Settings offers are brought within them.
+/// are the only output outside screenshots). Values outside the ranges Settings offers are brought within them, and a
+/// total below one file is raised to that file (), which the server refuses.
///
public static class AppLogging
{
@@ -16,18 +17,34 @@ public static class AppLogging
public const int MaxTotalMb = 1024 * 1024;
public const int MaxDiagnosticsLogMb = 1024;
- public static LogFileOptions Options(AppSettings settings) => new()
+ public static LogFileOptions Options(AppSettings settings)
{
- Level = Enum.IsDefined(settings.LogLevel) ? settings.LogLevel : LogLevel.Info,
- RetentionDays = int.Clamp(settings.LogRetentionDays, 1, MaxRetentionDays),
- MaxFileMb = int.Clamp(settings.LogMaxFileMb, 0, MaxFileMb),
- MaxTotalMb = int.Clamp(settings.LogMaxTotalMb, 0, MaxTotalMb),
- Rotation = Enum.IsDefined(settings.LogRotation) ? settings.LogRotation : LogRotation.Daily,
- };
+ var file = int.Clamp(settings.LogMaxFileMb, 0, MaxFileMb);
+ var total = int.Clamp(settings.LogMaxTotalMb, 0, MaxTotalMb);
+ return new()
+ {
+ Level = Enum.IsDefined(settings.LogLevel) ? settings.LogLevel : LogLevel.Info,
+ RetentionDays = int.Clamp(settings.LogRetentionDays, 1, MaxRetentionDays),
+ MaxFileMb = file,
+ MaxTotalMb = LogFileOptions.TotalBelowFile(file, total) ? file : total,
+ Rotation = Enum.IsDefined(settings.LogRotation) ? settings.LogRotation : LogRotation.Daily,
+ };
+ }
/// Bytes the diagnostics bundle keeps from the end of each log file.
public static long DiagnosticsTailBytes(AppSettings settings) => int.Clamp(settings.DiagnosticsLogMb, 1, MaxDiagnosticsLogMb) * LogFileOptions.BytesPerMb;
+ ///
+ /// The log files App starts with, in , with from the first line:
+ /// that line opens a file and prunes, so the defaults would delete what the user keeps longer.
+ ///
+ public static FileLogSink Open(string directory, AppSettings settings)
+ {
+ var options = Options(settings);
+ Log.MinimumLevel = options.Level;
+ return new FileLogSink(directory, "chronos", options);
+ }
+
/// The settings to and the engine, from the next line on.
public static void Apply(FileLogSink sink, AppSettings settings)
{
diff --git a/src/Chronos.App/Settings/LogSettingsRows.cs b/src/Chronos.App/Settings/LogSettingsRows.cs
index d2b295d9..c6c9d6ea 100644
--- a/src/Chronos.App/Settings/LogSettingsRows.cs
+++ b/src/Chronos.App/Settings/LogSettingsRows.cs
@@ -8,8 +8,10 @@ namespace Chronos.App.Settings;
///
/// The log rows of Settings › Advanced (owner review 2, R11): level, retention, file size, total size and rotation of this
/// PC's log files, and how much of each the diagnostics bundle keeps. Each choice is stored and saved at once, and saving
-/// applies it to the files (). A value set elsewhere (an imported settings file) is listed with
-/// the presets, never shown as another one.
+/// applies it to the files (). The rows show the values the files get: one set elsewhere (an
+/// imported or hand-edited settings file) is brought within range as does, then listed
+/// with the presets. File sizes above the total and totals below the file size are not offered
+/// ().
///
public sealed class LogSettingsRows(AppSettings settings, Action save) : ObservableObject
{
@@ -28,28 +30,49 @@ public sealed class LogSettingsRows(AppSettings settings, Action save) : Observa
}
public IReadOnlyList> RetentionChoices =>
- [.. With(RetentionPresets, settings.LogRetentionDays).Select(n => new SettingsOption(n, Loc.Plural("Settings.Advanced.Days", n)))];
+ [.. With(RetentionPresets, Applied.RetentionDays).Select(n => new SettingsOption(n, Loc.Plural("Settings.Advanced.Days", n)))];
public SettingsOption SelectedRetention
{
- get => RetentionChoices.First(c => c.Value == settings.LogRetentionDays);
+ get => Selected(RetentionChoices, Applied.RetentionDays);
set => Store(value, settings.LogRetentionDays, v => settings.LogRetentionDays = v);
}
- public IReadOnlyList> FileSizeChoices => Sizes(FileSizePresets, settings.LogMaxFileMb);
+ public IReadOnlyList> FileSizeChoices
+ {
+ get
+ {
+ var applied = Applied;
+ return Sizes(FileSizePresets, applied.MaxFileMb, n => !LogFileOptions.TotalBelowFile(n, applied.MaxTotalMb));
+ }
+ }
public SettingsOption SelectedFileSize
{
- get => FileSizeChoices.First(c => c.Value == settings.LogMaxFileMb);
- set => Store(value, settings.LogMaxFileMb, v => settings.LogMaxFileMb = v);
+ get => Selected(FileSizeChoices, Applied.MaxFileMb);
+ set
+ {
+ // The totals offered depend on the file size.
+ if (Store(value, settings.LogMaxFileMb, v => settings.LogMaxFileMb = v)) Changed(nameof(TotalSizeChoices), nameof(SelectedTotalSize));
+ }
}
- public IReadOnlyList> TotalSizeChoices => Sizes(TotalSizePresets, settings.LogMaxTotalMb);
+ public IReadOnlyList> TotalSizeChoices
+ {
+ get
+ {
+ var applied = Applied;
+ return Sizes(TotalSizePresets, applied.MaxTotalMb, n => !LogFileOptions.TotalBelowFile(applied.MaxFileMb, n));
+ }
+ }
public SettingsOption SelectedTotalSize
{
- get => TotalSizeChoices.First(c => c.Value == settings.LogMaxTotalMb);
- set => Store(value, settings.LogMaxTotalMb, v => settings.LogMaxTotalMb = v);
+ get => Selected(TotalSizeChoices, Applied.MaxTotalMb);
+ set
+ {
+ if (Store(value, settings.LogMaxTotalMb, v => settings.LogMaxTotalMb = v)) Changed(nameof(FileSizeChoices), nameof(SelectedFileSize));
+ }
}
public IReadOnlyList> Rotations =>
@@ -62,11 +85,11 @@ public sealed class LogSettingsRows(AppSettings settings, Action save) : Observa
}
public IReadOnlyList> DiagnosticsChoices =>
- [.. With(DiagnosticsPresets, settings.DiagnosticsLogMb).Select(n => new SettingsOption(n, Megabytes(n)))];
+ [.. With(DiagnosticsPresets, AppliedDiagnosticsMb).Select(n => new SettingsOption(n, Megabytes(n)))];
public SettingsOption SelectedDiagnostics
{
- get => DiagnosticsChoices.First(c => c.Value == settings.DiagnosticsLogMb);
+ get => Selected(DiagnosticsChoices, AppliedDiagnosticsMb);
set => Store(value, settings.DiagnosticsLogMb, v => settings.DiagnosticsLogMb = v);
}
@@ -86,18 +109,39 @@ public sealed class LogSettingsRows(AppSettings settings, Action save) : Observa
/// Labels in the current language, values as the settings have them now.
internal void Refresh() => OnAllPropertiesChanged();
- private void Store(SettingsOption? choice, T current, Action set, [System.Runtime.CompilerServices.CallerMemberName] string? property = null)
+ /// The values the log files get from the settings now.
+ private LogFileOptions Applied => AppLogging.Options(settings);
+
+ private int AppliedDiagnosticsMb => (int)(AppLogging.DiagnosticsTailBytes(settings) / LogFileOptions.BytesPerMb);
+
+ ///
+ /// Stores a choice that differs from the stored value (, which may lie out of range: choosing
+ /// the value shown then saves it as applied) and saves; false when there was nothing to store.
+ ///
+ private bool Store(SettingsOption? choice, T current, Action set, [System.Runtime.CompilerServices.CallerMemberName] string? property = null)
{
- if (choice is null || EqualityComparer.Default.Equals(choice.Value, current)) return;
+ if (choice is null || EqualityComparer.Default.Equals(choice.Value, current)) return false;
set(choice.Value);
save();
OnPropertyChanged(property);
+ return true;
}
- /// The presets in order, then "No limit" (0); joins them when it is another size.
- private static IReadOnlyList> Sizes(int[] presets, int current) =>
+ private void Changed(string choices, string selected)
+ {
+ OnPropertyChanged(choices);
+ OnPropertyChanged(selected);
+ }
+
+ private static SettingsOption Selected(IReadOnlyList> choices, int value) => choices.FirstOrDefault(c => c.Value == value) ?? choices[0];
+
+ ///
+ /// The presets in order, then "No limit" (0); joins them when it
+ /// is another size.
+ ///
+ private static IReadOnlyList> Sizes(int[] presets, int current, Func offered) =>
[
- .. With(presets, current).Where(n => n > 0).Select(n => new SettingsOption(n, Megabytes(n))),
+ .. With(presets.Where(offered).ToArray(), current).Where(n => n > 0).Select(n => new SettingsOption(n, Megabytes(n))),
new(0, Loc.L("Settings.Advanced.NoLimit")),
];
diff --git a/src/Chronos.Core/Diagnostics/FileLogSink.cs b/src/Chronos.Core/Diagnostics/FileLogSink.cs
index 5499f70c..f18cddfe 100644
--- a/src/Chronos.Core/Diagnostics/FileLogSink.cs
+++ b/src/Chronos.Core/Diagnostics/FileLogSink.cs
@@ -39,6 +39,12 @@ public sealed record LogFileOptions
public int MaxTotalMb { get; init; } = DefaultMaxTotalMb;
public LogRotation Rotation { get; init; } = LogRotation.Daily;
+
+ ///
+ /// Whether a total of is below one file of : each finished file
+ /// would be deleted as soon as the next one opens. The server refuses such settings; the desktop raises the total.
+ ///
+ public static bool TotalBelowFile(int maxFileMb, int maxTotalMb) => maxTotalMb > 0 && maxFileMb > maxTotalMb;
}
///
diff --git a/src/Chronos.Protocol/Admin.cs b/src/Chronos.Protocol/Admin.cs
index ee3c9ea0..14e7e3f9 100644
--- a/src/Chronos.Protocol/Admin.cs
+++ b/src/Chronos.Protocol/Admin.cs
@@ -2,7 +2,8 @@ namespace Chronos.Protocol;
///
/// GET/PUT /api/v1/server/settings (admin): the editable part of the server configuration. Settings named in
-/// come from environment variables and cannot be changed here; says
+/// come from environment variables and cannot be changed here; names the
+/// variable that fixes each of them (ignored when saving); says
/// that saved values (ports, TLS, chunk size) wait for a restart; is what the housekeeping
/// schedule is reset to (owner review 2, R10). is set in responses when TLS mode is proxy and
/// the request did not come through a trusted proxy over HTTPS (ignored when saving).
@@ -29,6 +30,7 @@ public sealed record ServerSettingsDto(
int UploadRetentionHours,
LogSettingsDto Logs,
IReadOnlyList Locked,
+ IReadOnlyDictionary LockedBy,
bool RestartRequired,
bool ProxyWarning);
diff --git a/src/Chronos.Server/Admin/web/pages/settings.js b/src/Chronos.Server/Admin/web/pages/settings.js
index 2520d6b5..837e588c 100644
--- a/src/Chronos.Server/Admin/web/pages/settings.js
+++ b/src/Chronos.Server/Admin/web/pages/settings.js
@@ -9,16 +9,6 @@ import { t, applyStrings, languages } from "../i18n.js";
import { escapeHtml, attr, toast, errorText, nativeName, fingerprint, formatDuration, markInvalid, clearInvalid, invalidText, escapeReverts, routeParams, PROXY_WARNING } from "../ui.js";
import { kindLabel } from "../jobs.js";
-/** Setting → environment variable that can fix it (BRIEF §14.9). */
-const VARIABLES = {
- serverName: "CHRONOS_SERVER_NAME", httpPort: "CHRONOS_HTTP_PORT", httpsPort: "CHRONOS_HTTPS_PORT", tlsMode: "CHRONOS_TLS_MODE",
- tlsCert: "CHRONOS_TLS_CERT", tlsKey: "CHRONOS_TLS_KEY", language: "CHRONOS_LANG", parallelism: "CHRONOS_PARALLELISM", discovery: "CHRONOS_DISCOVERY",
- priorityQueue: "CHRONOS_PRIORITY_QUEUE", logLevel: "CHRONOS_LOG_LEVEL", logRetentionDays: "CHRONOS_LOG_RETENTION_DAYS",
- logMaxFileMb: "CHRONOS_LOG_MAX_FILE_MB", logMaxTotalMb: "CHRONOS_LOG_MAX_TOTAL_MB", logRotation: "CHRONOS_LOG_ROTATION",
- auditRetentionDays: "CHRONOS_AUDIT_RETENTION_DAYS", diagnosticsLogMb: "CHRONOS_DIAGNOSTICS_LOG_MB",
- // CHRONOS_LOG_LEVEL sets the console's level too, unless CHRONOS_LOG_CONSOLE_LEVEL sets its own.
- consoleLogLevel: ["CHRONOS_LOG_CONSOLE_LEVEL", "CHRONOS_LOG_LEVEL"],
-};
/** Levels of the priority queue, highest first. */
const LEVELS = ["high", "normal", "low"];
/** Log levels, least severe first (the server's wire names). */
@@ -47,9 +37,12 @@ export async function render(root, { api, info, setMeta, actions }) {
actions.innerHTML = ``;
applyStrings(actions);
- const locked = (name) => settings.locked.some((l) => l.toLowerCase() === name.toLowerCase());
- const lockedTip = (variable) => Array.isArray(variable) ? t("Admin.Settings.LockedEither.Tip", variable[0], variable[1]) : t("Admin.Settings.Locked.Tip", variable);
- const lock = (name) => locked(name) ? `disabled title="${attr(lockedTip(VARIABLES[name] ?? name))}"` : `data-i18n-title="Admin.Settings.${cap(name)}.Tip"`;
+ const same = (a, b) => a.toLowerCase() === b.toLowerCase();
+ const locked = (name) => settings.locked.some((l) => same(l, name));
+ // The server names the variable that fixes each locked setting: CHRONOS_LOG_LEVEL fixes the console's level too, unless
+ // CHRONOS_LOG_CONSOLE_LEVEL sets its own (BRIEF §14.9).
+ const variable = (name) => Object.entries(settings.lockedBy ?? {}).find(([setting]) => same(setting, name))?.[1] ?? name;
+ const lock = (name) => locked(name) ? `disabled title="${attr(t("Admin.Settings.Locked.Tip", variable(name)))}"` : `data-i18n-title="Admin.Settings.${cap(name)}.Tip"`;
const field = (name, input) => ``;
const number = (name, value, attrs = "") => field(name, ``);
const text = (name, value, attrs = "dir=\"auto\"") => field(name, ``);
diff --git a/src/Chronos.Server/Configuration/ServerOptions.cs b/src/Chronos.Server/Configuration/ServerOptions.cs
index a2d6f689..0fe87331 100644
--- a/src/Chronos.Server/Configuration/ServerOptions.cs
+++ b/src/Chronos.Server/Configuration/ServerOptions.cs
@@ -88,6 +88,9 @@ public sealed class ServerOptions
///
public const string DefaultTrustedProxies = "127.0.0.0/8, ::1/128";
+ /// The environment variable that sets (of two, the one that wins), or null.
+ public static string? VariableOf(string setting) => Variables.LastOrDefault(v => v.Setting == setting).Variable;
+
/// The environment variables the server reads (--help lists them all).
public static IEnumerable EnvironmentVariables => Variables.Select(v => v.Variable).Distinct(StringComparer.Ordinal).Prepend("CHRONOS_DATA_PATH");
@@ -248,6 +251,13 @@ public sealed class ServerOptions
[JsonIgnore]
public IReadOnlyCollection Locked { get; internal set; } = [];
+ ///
+ /// The environment variable that fixes each setting of , which the admin panel names: of two that
+ /// set one (CHRONOS_LOG_LEVEL and CHRONOS_LOG_CONSOLE_LEVEL), the one that wins.
+ ///
+ [JsonIgnore]
+ public IReadOnlyDictionary LockedBy { get; internal set; } = new Dictionary(StringComparer.Ordinal);
+
[JsonIgnore]
public string LogPath => Path.Combine(DataPath, "logs");
@@ -292,6 +302,7 @@ public sealed class ServerOptions
options.DataPath = dataPath;
var locked = new List();
+ var lockedBy = new Dictionary(StringComparer.Ordinal);
foreach (var (variable, setting, apply) in Variables)
{
if (Env(variable) is not { } value) continue;
@@ -304,8 +315,11 @@ public sealed class ServerOptions
throw new InvalidOperationException($"{variable} has an invalid value.", ex);
}
locked.Add(setting);
+ // Listed in the order they apply: a later variable wins.
+ lockedBy[setting] = variable;
}
options.Locked = [.. locked.Distinct(StringComparer.Ordinal)];
+ options.LockedBy = lockedBy;
// The admin panel saves only values it accepts: one it cannot change (an environment variable) must be one of them.
options.Parallelism = Math.Clamp(options.Parallelism, 1, MaxParallelism);
options.Validate();
diff --git a/src/Chronos.Server/Configuration/ServerSettingsStore.cs b/src/Chronos.Server/Configuration/ServerSettingsStore.cs
index 4513a4e5..39a7571f 100644
--- a/src/Chronos.Server/Configuration/ServerSettingsStore.cs
+++ b/src/Chronos.Server/Configuration/ServerSettingsStore.cs
@@ -89,6 +89,7 @@ public sealed class ServerSettingsStore(ServerOptions options, ServerLogging log
JobPriorities = Priorities(PriorityQueue(options)),
Logs = Logs(options),
Locked = [.. options.Locked],
+ LockedBy = LockedBy(options),
RestartRequired = restart,
ProxyWarning = false,
};
@@ -99,7 +100,11 @@ public sealed class ServerSettingsStore(ServerOptions options, ServerLogging log
private static ServerSettingsDto Snapshot(ServerOptions o, bool restartRequired) => new(
o.ServerName, o.HttpPort, o.HttpsPort, o.TlsMode.ToString().ToLowerInvariant(), o.TlsCert, o.TlsKey, o.Language, o.Parallelism, o.PriorityQueue,
Priorities(PriorityQueue(o)), o.Discovery, o.MaxUploadBytes, o.ChunkSizeBytes, o.JobHistoryDays, o.TokenLifetimeDays, o.UploadRetentionHours,
- Logs(o), [.. o.Locked], restartRequired, ProxyWarning: false);
+ Logs(o), [.. o.Locked], LockedBy(o), restartRequired, ProxyWarning: false);
+
+ /// The variable that fixes every locked setting (for one a test locks directly, the variable that would).
+ private static Dictionary LockedBy(ServerOptions o) => o.Locked.Distinct(StringComparer.Ordinal).ToDictionary(s => s,
+ s => o.LockedBy.TryGetValue(s, out var variable) ? variable : ServerOptions.VariableOf(s) ?? s, StringComparer.Ordinal);
private static LogSettingsDto Logs(ServerOptions o) => new(ServerLogging.Wire(o.LogLevel), ServerLogging.Wire(o.ConsoleLogLevel), o.LogRetentionDays,
o.LogMaxFileMb, o.LogMaxTotalMb, ServerLogging.Wire(o.LogRotation), o.AuditRetentionDays, o.DiagnosticsLogMb);
diff --git a/src/Chronos.Server/Hosting/ServerLogging.cs b/src/Chronos.Server/Hosting/ServerLogging.cs
index 9f8b220d..e9a196d1 100644
--- a/src/Chronos.Server/Hosting/ServerLogging.cs
+++ b/src/Chronos.Server/Hosting/ServerLogging.cs
@@ -149,8 +149,7 @@ public sealed class ServerLogging
{
if (retentionDays is < 1 or > MaxRetentionDays) return nameof(ServerOptions.LogRetentionDays);
if (maxFileMb is < 0 or > MaxFileMb) return nameof(ServerOptions.LogMaxFileMb);
- // A total below one file would delete every finished file at once.
- if (maxTotalMb is < 0 or > MaxTotalMb || (maxTotalMb > 0 && maxFileMb > maxTotalMb)) return nameof(ServerOptions.LogMaxTotalMb);
+ if (maxTotalMb is < 0 or > MaxTotalMb || LogFileOptions.TotalBelowFile(maxFileMb, maxTotalMb)) return nameof(ServerOptions.LogMaxTotalMb);
if (auditRetentionDays is < 0 or > MaxAuditRetentionDays) return nameof(ServerOptions.AuditRetentionDays);
if (diagnosticsLogMb is < 1 or > MaxDiagnosticsLogMb) return nameof(ServerOptions.DiagnosticsLogMb);
return null;
diff --git a/tests/Chronos.App.Tests/Settings/LogSettingsTests.cs b/tests/Chronos.App.Tests/Settings/LogSettingsTests.cs
index 609353b8..e4be09e4 100644
--- a/tests/Chronos.App.Tests/Settings/LogSettingsTests.cs
+++ b/tests/Chronos.App.Tests/Settings/LogSettingsTests.cs
@@ -1,4 +1,5 @@
using System.Globalization;
+using System.IO;
using Chronos.App.Infrastructure;
using Chronos.App.Settings;
using Chronos.Core.Diagnostics;
@@ -58,6 +59,18 @@ public sealed class LogSettingsTests
var odd = new AppSettings { LogLevel = (LogLevel)42, LogRetentionDays = 0, LogMaxFileMb = -3, LogMaxTotalMb = -1, LogRotation = (LogRotation)7, DiagnosticsLogMb = 0 };
Assert.Equal(new LogFileOptions { RetentionDays = 1, MaxFileMb = 0, MaxTotalMb = 0 }, AppLogging.Options(odd));
Assert.Equal(1L << 20, AppLogging.DiagnosticsTailBytes(odd));
+ var huge = new AppSettings { LogRetentionDays = 99_999, LogMaxFileMb = 99_999, LogMaxTotalMb = int.MaxValue, DiagnosticsLogMb = 5000 };
+ Assert.Equal(new LogFileOptions { RetentionDays = 3650, MaxFileMb = 10_240, MaxTotalMb = 1_048_576 }, AppLogging.Options(huge));
+ Assert.Equal(1024L << 20, AppLogging.DiagnosticsTailBytes(huge));
+
+ // A total below one file would delete each finished file as the next one opens: it is raised to the file (the
+ // server refuses it). Without a file limit any total holds.
+ Assert.True(LogFileOptions.TotalBelowFile(500, 256));
+ Assert.False(LogFileOptions.TotalBelowFile(256, 256) || LogFileOptions.TotalBelowFile(500, 0) || LogFileOptions.TotalBelowFile(0, 256));
+ var below = AppLogging.Options(new AppSettings { LogMaxFileMb = 500, LogMaxTotalMb = 256 });
+ Assert.Equal((500, 500), (below.MaxFileMb, below.MaxTotalMb));
+ var free = AppLogging.Options(new AppSettings { LogMaxFileMb = 0, LogMaxTotalMb = 256 });
+ Assert.Equal((0, 256), (free.MaxFileMb, free.MaxTotalMb));
var level = Log.MinimumLevel;
using var sink = new FileLogSink(_context.CreateTempDirectory(), "chronos");
@@ -73,6 +86,33 @@ public sealed class LogSettingsTests
}
}
+ [Test]
+ public void TheLogFilesStartWithTheSettings()
+ {
+ // App opens its files with the settings: the first line opens a file and prunes, at every start and at every launch
+ // that only hands over to the running Chronos, so the defaults would delete what the user keeps longer.
+ var level = Log.MinimumLevel;
+ try
+ {
+ foreach (var (settings, kept) in new[] { (new AppSettings { LogLevel = LogLevel.Debug, LogRetentionDays = 365, LogMaxTotalMb = 0 }, true), (new AppSettings(), false) })
+ {
+ var dir = _context.CreateTempDirectory();
+ var old = Path.Combine(dir, $"chronos-{DateTime.UtcNow.AddDays(-30):yyyyMMdd}.log");
+ File.WriteAllText(old, "a month ago");
+ File.SetLastWriteTimeUtc(old, DateTime.UtcNow.AddDays(-30));
+ using var sink = AppLogging.Open(dir, settings);
+ Assert.Equal((AppLogging.Options(settings), settings.LogLevel), (sink.Options, Log.MinimumLevel));
+ sink.Write(LogLevel.Info, "app", "Chronos starting", null);
+ Assert.Equal(kept, File.Exists(old), $"retention {settings.LogRetentionDays} days");
+ Assert.FileExists(sink.CurrentPath);
+ }
+ }
+ finally
+ {
+ Log.MinimumLevel = level;
+ }
+ }
+
[Test]
public void EachRowStoresAndSavesItsChoice()
{
@@ -100,7 +140,9 @@ public sealed class LogSettingsTests
Assert.Equal((LogLevel.Debug, 90, 0, 5120, LogRotation.Hourly, 16),
(settings.LogLevel, settings.LogRetentionDays, settings.LogMaxFileMb, settings.LogMaxTotalMb, settings.LogRotation, settings.DiagnosticsLogMb));
Assert.Equal(6, saves);
- Assert.SequenceEqual(["SelectedLevel", "SelectedRetention", "SelectedFileSize", "SelectedTotalSize", "SelectedRotation", "SelectedDiagnostics"], changed);
+ // A size changes the choices of the other.
+ Assert.SequenceEqual(["SelectedLevel", "SelectedRetention", "SelectedFileSize", "TotalSizeChoices", "SelectedTotalSize", "SelectedTotalSize",
+ "FileSizeChoices", "SelectedFileSize", "SelectedRotation", "SelectedDiagnostics"], changed);
// The same choice again, or none (a list being rebuilt), changes nothing.
rows.SelectedLevel = rows.Levels.Single(l => l.Value == LogLevel.Debug);
@@ -122,4 +164,58 @@ public sealed class LogSettingsTests
Assert.Equal(string.Empty, changed.Single());
Assert.Equal(6, saves);
}
+
+ [Test]
+ public void TheSizeRowsNeverOfferATotalBelowOneFile()
+ {
+ var settings = new AppSettings { LogMaxFileMb = 500 };
+ var saves = 0;
+ var rows = new LogSettingsRows(settings, () => saves++);
+ Assert.SequenceEqual([512, 1024, 2048, 5120, 10240, 0], rows.TotalSizeChoices.Select(c => c.Value));
+ Assert.SequenceEqual([10, 20, 50, 100, 200, 500, 0], rows.FileSizeChoices.Select(c => c.Value));
+
+ rows.SelectedTotalSize = rows.TotalSizeChoices.Single(c => c.Value == 512);
+ rows.SelectedFileSize = rows.FileSizeChoices.Single(c => c.Value == 100);
+ rows.SelectedTotalSize = rows.TotalSizeChoices.Single(c => c.Value == 256);
+ Assert.Equal((100, 256, 3), (settings.LogMaxFileMb, settings.LogMaxTotalMb, saves));
+ Assert.SequenceEqual([10, 20, 50, 100, 200, 0], rows.FileSizeChoices.Select(c => c.Value));
+ // Without a file limit every total is offered, and without a total every file size.
+ rows.SelectedFileSize = rows.FileSizeChoices[^1];
+ Assert.SequenceEqual([256, 512, 1024, 2048, 5120, 10240, 0], rows.TotalSizeChoices.Select(c => c.Value));
+ rows.SelectedTotalSize = rows.TotalSizeChoices[^1];
+ Assert.SequenceEqual([10, 20, 50, 100, 200, 500, 0], rows.FileSizeChoices.Select(c => c.Value));
+
+ // An imported file with a total below its file size shows the total the files get.
+ settings.LogMaxFileMb = 500;
+ settings.LogMaxTotalMb = 256;
+ Assert.Equal(("500 MB", "500 MB"), (rows.SelectedFileSize.Label, rows.SelectedTotalSize.Label));
+ Assert.SequenceEqual([500, 512, 1024, 2048, 5120, 10240, 0], rows.TotalSizeChoices.Select(c => c.Value));
+ }
+
+ [Test]
+ public void OutOfRangeValuesShowWhatTheFilesGet()
+ {
+ // A hand-edited or imported settings file: every row shows the value applied, and none fails to find its choice.
+ var settings = new AppSettings { LogLevel = (LogLevel)42, LogRetentionDays = 0, LogMaxFileMb = -3, LogMaxTotalMb = -1, LogRotation = (LogRotation)7, DiagnosticsLogMb = 0 };
+ var saves = 0;
+ var rows = new LogSettingsRows(settings, () => saves++);
+ Assert.Equal(("Information", "1 day", "No limit", "No limit", "Daily", "1 MB"), (rows.SelectedLevel.Label, rows.SelectedRetention.Label,
+ rows.SelectedFileSize.Label, rows.SelectedTotalSize.Label, rows.SelectedRotation.Label, rows.SelectedDiagnostics.Label));
+ Assert.SequenceEqual(LogSettingsRows.RetentionPresets, rows.RetentionChoices.Select(c => c.Value));
+ Assert.SequenceEqual([.. LogSettingsRows.FileSizePresets, 0], rows.FileSizeChoices.Select(c => c.Value));
+ Assert.SequenceEqual(LogSettingsRows.DiagnosticsPresets, rows.DiagnosticsChoices.Select(c => c.Value));
+
+ // Choosing the value shown saves it as applied.
+ var (shownFile, shownRetention) = (rows.SelectedFileSize, rows.SelectedRetention);
+ rows.SelectedFileSize = shownFile;
+ rows.SelectedRetention = shownRetention;
+ Assert.Equal((0, 1, 2), (settings.LogMaxFileMb, settings.LogRetentionDays, saves));
+
+ settings.LogRetentionDays = 99_999;
+ settings.LogMaxFileMb = 99_999;
+ settings.LogMaxTotalMb = int.MaxValue;
+ settings.DiagnosticsLogMb = 5000;
+ Assert.Equal(("3650 days", "10,240 MB", "1,048,576 MB", "1,024 MB"),
+ (rows.SelectedRetention.Label, rows.SelectedFileSize.Label, rows.SelectedTotalSize.Label, rows.SelectedDiagnostics.Label));
+ }
}
diff --git a/tests/Chronos.Core.Tests/Diagnostics/FileLogSinkTests.cs b/tests/Chronos.Core.Tests/Diagnostics/FileLogSinkTests.cs
index 1115ead9..95a32d37 100644
--- a/tests/Chronos.Core.Tests/Diagnostics/FileLogSinkTests.cs
+++ b/tests/Chronos.Core.Tests/Diagnostics/FileLogSinkTests.cs
@@ -142,9 +142,12 @@ public sealed class FileLogSinkTests(TestContext context)
var sink = new FileLogSink(dir, "setup", 7);
Assert.Equal(new LogFileOptions { RetentionDays = 7 }, sink.Options);
Assert.Equal((LogLevel.Info, 50, 1024, LogRotation.Daily), (sink.Options.Level, sink.Options.MaxFileMb, sink.Options.MaxTotalMb, sink.Options.Rotation));
+ var before = DateTime.UtcNow;
sink.Write(LogLevel.Warning, "setup", "written", null);
- var expected = Path.Combine(dir, $"setup-{DateTime.UtcNow:yyyyMMdd}.log");
- Assert.Equal(expected, sink.CurrentPath);
+ var after = DateTime.UtcNow;
+ // The system clock: a write across midnight UTC names either day.
+ var expected = sink.CurrentPath;
+ Assert.Contains(expected, new[] { before, after }.Select(day => Path.Combine(dir, $"setup-{day:yyyyMMdd}.log")));
sink.Dispose();
// Engine code may log after the host closed its sink: the line is dropped.
sink.Write(LogLevel.Error, "setup", "after", null);
diff --git a/tests/Chronos.Server.Tests/Hosting/LoggingTests.cs b/tests/Chronos.Server.Tests/Hosting/LoggingTests.cs
index 742edab0..2c5f4762 100644
--- a/tests/Chronos.Server.Tests/Hosting/LoggingTests.cs
+++ b/tests/Chronos.Server.Tests/Hosting/LoggingTests.cs
@@ -147,19 +147,28 @@ public sealed partial class LoggingTests(TestContext context)
[Test]
public async Task LevelsSetByTheEnvironmentAreLocked()
{
- await using var server = await TestServer.StartAsync(context, o => o.Locked = [nameof(ServerOptions.LogLevel), nameof(ServerOptions.ConsoleLogLevel)]);
+ // An install upgraded with the earlier compose file or Unraid template: CHRONOS_LOG_LEVEL fixes both levels.
+ await using var server = await TestServer.StartAsync(context, o =>
+ {
+ o.Locked = [nameof(ServerOptions.LogLevel), nameof(ServerOptions.ConsoleLogLevel), nameof(ServerOptions.LogRotation)];
+ o.LockedBy = new Dictionary { [nameof(ServerOptions.LogLevel)] = "CHRONOS_LOG_LEVEL", [nameof(ServerOptions.ConsoleLogLevel)] = "CHRONOS_LOG_LEVEL" };
+ });
var admin = await server.AdminAsync();
var settings = await SettingsAsync(admin);
Assert.Contains("ConsoleLogLevel", settings.Locked);
+ // The panel's tooltip names the variable that fixes each; one locked without it is named by the variable that would.
+ string[] lockedBy = ["ConsoleLogLevel=CHRONOS_LOG_LEVEL", "LogLevel=CHRONOS_LOG_LEVEL", "LogRotation=CHRONOS_LOG_ROTATION"];
+ Assert.SequenceEqual(lockedBy, settings.LockedBy.Select(l => $"{l.Key}={l.Value}").Order(StringComparer.Ordinal));
var edited = settings with { HttpPort = 18080, HttpsPort = 18443 };
using (var refused = await admin.PutAsJsonAsync("/api/v1/server/settings", edited with { Logs = edited.Logs with { ConsoleLevel = "debug" } },
ProtocolJson.Default.ServerSettingsDto))
Assert.Equal("ConsoleLogLevel", (await refused.ExpectErrorAsync(HttpStatusCode.Conflict, "setting_locked")).Details);
Assert.Equal(LogLevel.Warning, server.Options.ConsoleLogLevel);
// The settings no variable fixes still save.
- using (var saved = await admin.PutAsJsonAsync("/api/v1/server/settings", edited with { Logs = edited.Logs with { RetentionDays = 7 } },
- ProtocolJson.Default.ServerSettingsDto))
- await saved.ExpectAsync(HttpStatusCode.OK);
+ // What a request says about the locks is ignored.
+ using (var saved = await admin.PutAsJsonAsync("/api/v1/server/settings",
+ edited with { Logs = edited.Logs with { RetentionDays = 7 }, LockedBy = new Dictionary() }, ProtocolJson.Default.ServerSettingsDto))
+ Assert.SequenceEqual(lockedBy, (await saved.ReadAsync(ProtocolJson.Default.ServerSettingsDto)).LockedBy.Select(l => $"{l.Key}={l.Value}").Order(StringComparer.Ordinal));
Assert.Equal(7, server.Options.LogRetentionDays);
}
diff --git a/tests/Chronos.Server.Tests/Hosting/StartupTests.cs b/tests/Chronos.Server.Tests/Hosting/StartupTests.cs
index 0d353cf3..f2e0e8ab 100644
--- a/tests/Chronos.Server.Tests/Hosting/StartupTests.cs
+++ b/tests/Chronos.Server.Tests/Hosting/StartupTests.cs
@@ -72,6 +72,8 @@ public sealed class StartupTests(TestContext context)
["CHRONOS_DISCOVERY"] = "false",
});
Assert.SequenceEqual(["Database", "HttpPort", "Discovery"], options.Locked);
+ // The admin panel names the variable that fixes each of them.
+ Assert.Equal(("CHRONOS_DB", "CHRONOS_HTTP_PORT", "CHRONOS_DISCOVERY"), (options.LockedBy["Database"], options.LockedBy["HttpPort"], options.LockedBy["Discovery"]));
Assert.Throws(() => ServerOptions.Load(new Dictionary { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_WORKERS"] = "many" }));
}
@@ -86,6 +88,7 @@ public sealed class StartupTests(TestContext context)
var former = ServerOptions.Load(new Dictionary { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_WORKERS"] = "5" });
Assert.Equal((5, true), (former.Parallelism, former.FormerWorkersVariable));
Assert.SequenceEqual(["Database", "Parallelism"], former.Locked);
+ Assert.Equal("CHRONOS_WORKERS", former.LockedBy["Parallelism"]);
var both = ServerOptions.Load(new Dictionary
{
["CHRONOS_DATA_PATH"] = root,
@@ -96,6 +99,7 @@ public sealed class StartupTests(TestContext context)
});
Assert.Equal((7, true), (both.Parallelism, both.PriorityQueue));
Assert.SequenceEqual(["Database", "Parallelism", "PriorityQueue"], both.Locked);
+ Assert.Equal("CHRONOS_PARALLELISM", both.LockedBy["Parallelism"]);
Assert.False(ServerOptions.Load(new Dictionary { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_PARALLELISM"] = "2" })
.FormerWorkersVariable);
Assert.Throws(() => ServerOptions.Load(new Dictionary { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_PRIORITY_QUEUE"] = "often" }));
@@ -174,6 +178,8 @@ public sealed class StartupTests(TestContext context)
var both = ServerOptions.Load(Env(("CHRONOS_LOG_LEVEL", "debug")));
Assert.Equal((Microsoft.Extensions.Logging.LogLevel.Debug, Microsoft.Extensions.Logging.LogLevel.Debug), (both.LogLevel, both.ConsoleLogLevel));
Assert.SequenceEqual(["Database", "LogLevel", "ConsoleLogLevel"], both.Locked);
+ // The earlier compose file and Unraid template set CHRONOS_LOG_LEVEL: the panel names it on both levels.
+ Assert.Equal(("CHRONOS_LOG_LEVEL", "CHRONOS_LOG_LEVEL"), (both.LockedBy["LogLevel"], both.LockedBy["ConsoleLogLevel"]));
var all = ServerOptions.Load(Env(("CHRONOS_LOG_LEVEL", "Trace"), ("CHRONOS_LOG_CONSOLE_LEVEL", "warn"), ("CHRONOS_LOG_RETENTION_DAYS", "30"),
("CHRONOS_LOG_MAX_FILE_MB", "0"), ("CHRONOS_LOG_MAX_TOTAL_MB", "2048"), ("CHRONOS_LOG_ROTATION", "Hourly"), ("CHRONOS_AUDIT_RETENTION_DAYS", "365"),
@@ -183,6 +189,7 @@ public sealed class StartupTests(TestContext context)
Assert.Equal((Chronos.Core.Diagnostics.LogRotation.Hourly, 365, 16), (all.LogRotation, all.AuditRetentionDays, all.DiagnosticsLogMb));
Assert.SequenceEqual(["Database", "LogLevel", "ConsoleLogLevel", "LogRetentionDays", "LogMaxFileMb", "LogMaxTotalMb", "LogRotation", "AuditRetentionDays",
"DiagnosticsLogMb"], all.Locked);
+ Assert.Equal(("CHRONOS_LOG_LEVEL", "CHRONOS_LOG_CONSOLE_LEVEL"), (all.LockedBy["LogLevel"], all.LockedBy["ConsoleLogLevel"]));
foreach (var invalid in new[]
{