Skip to content

Commit

Permalink
Disable logging to file system on default (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
mczachurski authored Apr 16, 2024
1 parent 2887d89 commit c3990b0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
22 changes: 11 additions & 11 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "f30252de67f1dd70655068e4c270b87c3859f0a0ac55f9c0036242cd5734d67b",
"originHash" : "b2d4035c6b4f1e083772179abbae31c6c0e31af1f2a7783daa877d16cb198bd9",
"pins" : [
{
"identity" : "async-http-client",
Expand Down Expand Up @@ -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"
}
},
{
Expand All @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand All @@ -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"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion Sources/VernissageServer/Entrypoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c3990b0

Please sign in to comment.