Modified log folder path

This commit is contained in:
kunkliricsi 2020-11-26 10:01:47 +01:00
parent bcbab1383a
commit aa39597541
3 changed files with 10 additions and 8 deletions

View File

@ -17,7 +17,7 @@ namespace Birdmap.API.Controllers
public class LogsController : ControllerBase public class LogsController : ControllerBase
{ {
private readonly ILogger<LogsController> _logger; private readonly ILogger<LogsController> _logger;
private readonly string _logFolderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Log"); private readonly string _logFolderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Logs");
public LogsController(ILogger<LogsController> logger) public LogsController(ILogger<LogsController> logger)
{ {
@ -27,7 +27,7 @@ namespace Birdmap.API.Controllers
[HttpGet("all")] [HttpGet("all")]
public ActionResult<List<string>> GetAll() public ActionResult<List<string>> GetAll()
{ {
_logger.LogInformation($"Getting all log filenames..."); _logger.LogInformation($"Getting all log filenames from folder: '{_logFolderPath}'...");
return Directory.EnumerateFiles(_logFolderPath, "*.log") return Directory.EnumerateFiles(_logFolderPath, "*.log")
.Select(f => Path.GetFileName(f)) .Select(f => Path.GetFileName(f))

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true" autoReload="true"
internalLogLevel="Info" internalLogLevel="Info"
internalLogFile="${basedir}Log/internal-nlog.txt" internalLogFile="${basedir}Logs/internal-nlog.txt"
throwConfigExceptions="true"> throwConfigExceptions="true">
<!-- enable asp.net core layout renderers --> <!-- enable asp.net core layout renderers -->
@ -14,17 +14,17 @@
<!-- the targets to write to --> <!-- the targets to write to -->
<targets async="true"> <targets async="true">
<default-target-parameters xsi:type="File" keepFileOpen="false" maxArchiveFiles="10" archiveAboveSize="1048576"/> <default-target-parameters xsi:type="File" keepFileOpen="false" maxArchiveFiles="10" archiveAboveSize="1048576"/>
<target xsi:type="File" name="allFile" fileName="${basedir}Log/birdmap-all-${shortdate}.log" <target xsi:type="File" name="allFile" fileName="${basedir}Logs/birdmap-all-${shortdate}.log"
layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${logger} - ${message} ${exception:format=tostring}" /> layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${logger} - ${message} ${exception:format=tostring}" />
<target xsi:type="File" name="mqttFile" fileName="${basedir}Log/birdmap-mqtt-${shortdate}.log" <target xsi:type="File" name="mqttFile" fileName="${basedir}Logs/birdmap-mqtt-${shortdate}.log"
layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${logger} - ${message} ${exception:format=tostring}" /> layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${logger} - ${message} ${exception:format=tostring}" />
<target xsi:type="File" name="hubsFile" fileName="${basedir}Log/birdmap-hubs-${shortdate}.log" <target xsi:type="File" name="hubsFile" fileName="${basedir}Logs/birdmap-hubs-${shortdate}.log"
layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${logger} - ${message} ${exception:format=tostring}" /> layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${logger} - ${message} ${exception:format=tostring}" />
<!-- another file log, only own logs. Uses some ASP.NET core renderers --> <!-- another file log, only own logs. Uses some ASP.NET core renderers -->
<target xsi:type="File" name="ownFile" fileName="${basedir}Log/birdmap-own-${shortdate}.log" <target xsi:type="File" name="ownFile" fileName="${basedir}Logs/birdmap-own-${shortdate}.log"
layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${callsite} - ${message} ${exception:format=tostring} (url: ${aspnet-request-url})(action: ${aspnet-mvc-action})" /> layout="${longdate} [${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} ${callsite} - ${message} ${exception:format=tostring} (url: ${aspnet-request-url})(action: ${aspnet-mvc-action})" />
</targets> </targets>

View File

@ -26,6 +26,7 @@ services:
- ASPNETCORE_HTTPS_PORT=8001 - ASPNETCORE_HTTPS_PORT=8001
- Birdmap_Kestrel__Certificates__Default__Password=certpass123 - Birdmap_Kestrel__Certificates__Default__Password=certpass123
- Birdmap_Kestrel__Certificates__Default__Path=/root/.aspnet/https/aspnetapp.pfx - Birdmap_Kestrel__Certificates__Default__Path=/root/.aspnet/https/aspnetapp.pfx
- Birdmap_Secret=7gz;]=bQe}n#3~RwC+Y<SrjoE:sHwO
- Birdmap_LocalDbConnectionString=Data Source=db;Initial Catalog=birdmap;User=sa;Password=RPSsql12345 - Birdmap_LocalDbConnectionString=Data Source=db;Initial Catalog=birdmap;User=sa;Password=RPSsql12345
- Birdmap_Defaults__Users__0__Name=admin - Birdmap_Defaults__Users__0__Name=admin
- Birdmap_Defaults__Users__0__Password=pass - Birdmap_Defaults__Users__0__Password=pass
@ -33,7 +34,8 @@ services:
- Birdmap_Defaults__Users__1__Name=user - Birdmap_Defaults__Users__1__Name=user
- Birdmap_Defaults__Users__1__Password=pass - Birdmap_Defaults__Users__1__Password=pass
- Birdmap_Defaults__Users__1__Role=User - Birdmap_Defaults__Users__1__Role=User
- Birdmap_Defaults__Services__Local-Database=https://localhost/health - Birdmap_Defaults__Services__Local-Database=https://localhost:8001/health
- Birdmap_Defaults__Services__KMLabz-Service=https://birb.k8s.kmlabz.com/devices
- Birdmap_UseDummyServices=true - Birdmap_UseDummyServices=true
- Birdmap_ServicesBaseUrl=https://birb.k8s.kmlabz.com/ - Birdmap_ServicesBaseUrl=https://birb.k8s.kmlabz.com/
- Birdmap_Mqtt__BrokerHostSettings__Host=localhost - Birdmap_Mqtt__BrokerHostSettings__Host=localhost