mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-16 18:43:43 +01:00
Fix file log levels among other things
This commit is contained in:
@@ -65,9 +65,9 @@ Create an `appsettings.Production.json` file next to `appsettings.json`. This wi
|
||||
|
||||
- `General:GitHubAccessToken`: Specify a GitHub personal access token with no scopes here to highly mitigate the possiblity of 429 response codes from GitHub requests
|
||||
|
||||
- `Logging:LogLevel:Default`: Can be one of `Trace`, `Debug`, `Information`, `Warning`, `Error`, or `Critical`. Restricts what is put into the log files. Currently `Debug` is reccommended for help with error reporting.
|
||||
- `General:LogFileLevel`: Can be one of `Trace`, `Debug`, `Information`, `Warning`, `Error`, or `Critical`. Restricts what is put into the log files. Currently `Debug` is reccommended for help with error reporting.
|
||||
|
||||
- `Kestrel:Endpoints:Http:Url`: The URL (i.e. interface and ports) your application should listen on. General use case should be `http://localhost:<port>` for restricted local connections. See the Remote Access section for configuring public access to the World Wide Web.
|
||||
- `Kestrel:Endpoints:Http:Url`: The URL (i.e. interface and ports) your application should listen on. General use case should be `http://localhost:<port>` for restricted local connections. See the Remote Access section for configuring public access to the World Wide Web. This doesn't need to be changed using the docker setup and should be mapped with the `-p` option instead
|
||||
|
||||
- `Database:DatabaseType`: Can be one of `SqlServer`, `MariaDB`, or `MySql`
|
||||
|
||||
|
||||
+2
-3
@@ -20,7 +20,7 @@ WORKDIR /src/src/Tgstation.Server.Host
|
||||
RUN dotnet publish -c Release -o /app/lib/Default && mv /app/lib/Default/appsettings* /app
|
||||
|
||||
FROM microsoft/dotnet:2.1-aspnetcore-runtime
|
||||
EXPOSE 5000
|
||||
EXPOSE 80
|
||||
|
||||
#needed for byond
|
||||
RUN apt-get update \
|
||||
@@ -32,9 +32,8 @@ WORKDIR /app
|
||||
|
||||
COPY --from=build /app .
|
||||
COPY --from=build /src/build/tgs.docker.sh tgs.sh
|
||||
COPY --from=build /src/src/Tgstation.Server.Host/appsettings.Docker.json .
|
||||
|
||||
RUN mkdir /config_data && mv appsettings.Docker.json /config_data/appsettings.Production.json
|
||||
RUN mkdir /config_data
|
||||
VOLUME ["/config_data", "/tgs_logs", "/app/lib"]
|
||||
|
||||
ENTRYPOINT ["./tgs.sh"]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir /config_data
|
||||
cp -r /config_data/* ./
|
||||
|
||||
exec dotnet Tgstation.Server.Host.Console.dll "$@"
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
/// </summary>
|
||||
public string LogFileDirectory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The stringified <see cref="Microsoft.Extensions.Logging.LogLevel"/> for file logging
|
||||
/// </summary>
|
||||
public string LogFileLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If file logging is disabled
|
||||
/// </summary>
|
||||
|
||||
@@ -54,6 +54,12 @@ namespace Tgstation.Server.Host.Core
|
||||
readonly Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment;
|
||||
|
||||
readonly TaskCompletionSource<object> startupTcs;
|
||||
static LogLevel GetMinimumLogLevel(string stringLevel)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(stringLevel) || !Enum.TryParse<LogLevel>(stringLevel, out var minimumLevel))
|
||||
minimumLevel = LogLevel.Information;
|
||||
return minimumLevel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct an <see cref="Application"/>
|
||||
@@ -94,7 +100,8 @@ namespace Tgstation.Server.Host.Core
|
||||
if (generalConfiguration?.DisableFileLogging != true)
|
||||
{
|
||||
var logPath = !String.IsNullOrEmpty(generalConfiguration?.LogFileDirectory) ? generalConfiguration.LogFileDirectory : ioManager.ConcatPath(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), VersionPrefix, "Logs");
|
||||
services.AddLogging(builder => builder.AddFile(ioManager.ConcatPath(logPath, "tgs-{Date}.log")));
|
||||
|
||||
services.AddLogging(builder => builder.AddFile(ioManager.ConcatPath(logPath, "tgs-{Date}.log"), GetMinimumLogLevel(generalConfiguration?.LogFileLevel)));
|
||||
}
|
||||
|
||||
services.AddOptions();
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"General": {
|
||||
"LogFileDirectory": "/tgs_logs",
|
||||
"MinimumPasswordLength": 15,
|
||||
"GitHubAccessToken": null
|
||||
},
|
||||
"Kestrel": {
|
||||
"Endpoints": {
|
||||
"Http": {
|
||||
"Url": "http://localhost:5000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Database": {
|
||||
"DatabaseType": "SqlServer or MySQL or MariaDB",
|
||||
"ConnectionString": "<Your connection string>",
|
||||
"MySqlServerVersion": "<Set if using MySQL/MariaDB i.e. 10.2.7>"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
"General": {
|
||||
"LogFileDirectory": null, //use the default path
|
||||
"DisableFileLogging": false,
|
||||
"LogFileLevel": "Debug",
|
||||
"MinimumPasswordLength": 15,
|
||||
"GitHubAccessToken": null
|
||||
},
|
||||
@@ -25,10 +26,6 @@
|
||||
"Default": "Trace",
|
||||
"Microsoft": "Warning"
|
||||
}
|
||||
},
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning"
|
||||
}
|
||||
},
|
||||
"Updates": {
|
||||
|
||||
Reference in New Issue
Block a user