From c3990b0a3274ffb15e5c74ead7771f1bb0231bf5 Mon Sep 17 00:00:00 2001 From: Marcin Czachurski Date: Tue, 16 Apr 2024 14:38:45 +0200 Subject: [PATCH] Disable logging to file system on default (#49) --- Package.resolved | 22 +++++++++---------- Package.swift | 2 +- Sources/VernissageServer/Entrypoint.swift | 2 +- .../HostVernissageServer.md | 14 +++++++++++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Package.resolved b/Package.resolved index bc8e307a..3dde03ce 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "f30252de67f1dd70655068e4c270b87c3859f0a0ac55f9c0036242cd5734d67b", + "originHash" : "b2d4035c6b4f1e083772179abbae31c6c0e31af1f2a7783daa877d16cb198bd9", "pins" : [ { "identity" : "async-http-client", @@ -51,8 +51,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Mikroservices/ExtendedLogging.git", "state" : { - "revision" : "6c671507516c990aab68632dbb047ba1e62957c6", - "version" : "2.0.4" + "revision" : "161755d8e75d163b6ba766f74865d06210904c3c", + "version" : "2.0.6" } }, { @@ -69,8 +69,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/fluent-kit.git", "state" : { - "revision" : "5f0938a3f5f1a751ff7a411117bfce4efe713526", - "version" : "1.47.2" + "revision" : "81db32f719a660f65266efeac121168db2710f20", + "version" : "1.47.3" } }, { @@ -123,8 +123,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/jwt-kit.git", "state" : { - "revision" : "e05513b5aec24f88012b6e3034115b6bc915356a", - "version" : "4.13.2" + "revision" : "c2595b9ad7f512d7f334830b4df1fed6e917946a", + "version" : "4.13.4" } }, { @@ -276,8 +276,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/sql-kit.git", "state" : { - "revision" : "b2f128cb62a3abfbb1e3b2893ff3ee69e70f4f0f", - "version" : "3.28.0" + "revision" : "cd0c5b7b4b61d6416f85964763f61c8967d093a5", + "version" : "3.29.1" } }, { @@ -294,8 +294,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/sqlite-nio.git", "state" : { - "revision" : "2102da7e204fa3b6eeac09a2d01b7aaa1f66c39a", - "version" : "1.8.7" + "revision" : "e79d223ab3705de4c1e8903961829b5d0098c820", + "version" : "1.8.8" } }, { diff --git a/Package.swift b/Package.swift index f081b31b..0941717f 100644 --- a/Package.swift +++ b/Package.swift @@ -27,7 +27,7 @@ let package = Package( .package(url: "https://github.com/Mikroservices/Recaptcha.git", from: "2.0.0"), // 📘 Custom logger handlers. - .package(url: "https://github.com/Mikroservices/ExtendedLogging.git", from: "2.0.4"), + .package(url: "https://github.com/Mikroservices/ExtendedLogging.git", from: "2.0.6"), // 📒 Library provides mechanism for reading configuration files. .package(url: "https://github.com/Mikroservices/ExtendedConfiguration.git", from: "1.0.0"), diff --git a/Sources/VernissageServer/Entrypoint.swift b/Sources/VernissageServer/Entrypoint.swift index 2df7b777..f5b1fb29 100644 --- a/Sources/VernissageServer/Entrypoint.swift +++ b/Sources/VernissageServer/Entrypoint.swift @@ -37,7 +37,7 @@ enum Entrypoint { LoggingSystem.bootstrap { label -> LogHandler in MultiplexLogHandler([ ConsoleLogger(label: label, console: Terminal(), level: level), - FileLogger(label: label, path: "Logs/vernissage.log", level: level), + FileLogger(label: label, path: Environment.get("VERNISSAGE_LOG_PATH"), level: level), SentryLogger(label: label, dsn: Environment.get("SENTRY_DSN"), application: Constants.name, diff --git a/Sources/VernissageServer/VernissageServer.docc/HostVernissageServer.md b/Sources/VernissageServer/VernissageServer.docc/HostVernissageServer.md index 4d933dc5..ff600227 100644 --- a/Sources/VernissageServer/VernissageServer.docc/HostVernissageServer.md +++ b/Sources/VernissageServer/VernissageServer.docc/HostVernissageServer.md @@ -75,9 +75,21 @@ Here you can configure three external resources: - `connectionString` - you can use SQLite or Postgres database connection string - `queueUrl` - URL to Redis in memory data store (used as cache and queue by Vernissage) - `s3*` - configuration of S3 storage. Here you can use any external S3 compatible cloud storage or [minio](https://min.io) docker ([https://hub.docker.com/r/minio/minio](https://hub.docker.com/r/minio/minio)) - + +> Note: If the `s3Region` variable is set, it causes the other settings to be overwritten and use Amazon AWS S3. + In production environment you can override configuration parameters by environment variables. For example if you want to set custom `baseAddress` you have to define variable: `VERNISSAGE_BASEADDRESS`, etc. +## File logger + +By default, the system displays logs only on the system console. If logging is also to be done to a file we need to set a system environment variable: + +- `VERNISSAGE_LOG_PATH` - file path e.g.: `logs/vernissage.log`. + +We can also set the default login level by setting a system environment variable: + +- `LOG_LEVEL` - more information about log levels you can find [here](https://docs.vapor.codes/basics/logging/). + ## Sentry It is possible to send application errors to the Sentry central logging system. To do this, set appropriate environment variables: