Update livello minimo log a debug

This commit is contained in:
Samuele Locatelli
2024-06-04 17:53:00 +02:00
parent 14fb396c00
commit 6bbc8b6fa0
12 changed files with 37 additions and 44 deletions
+3 -3
View File
@@ -348,14 +348,14 @@ namespace GWMS.UI.Controllers
{
// conversione dati
List<PlantLogModel> plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList();
Log.Trace($"flogJson | {id} | Convertiti {plData.Count} record");
Log.Debug($"flogJson | {id} | Convertiti {plData.Count} record");
// insert!
fatto = await _DataService.PlantLogInsert(plData);
Log.Trace($"flogJson | {id} | PlantLogInsert --> esito: {fatto}");
Log.Debug($"flogJson | {id} | PlantLogInsert --> esito: {fatto}");
// effettuo SEMPRE verifica per ricalcolo ordini...
await _DataService.checkLevels();
Log.Trace($"flogJson | {id} | chiamata checkLevels");
Log.Debug($"flogJson | {id} | chiamata checkLevels");
// leggo parametri correnti...
try
{
+2 -2
View File
@@ -54,7 +54,7 @@ namespace GWMS.UI.Controllers
[HttpGet]
public async Task<List<PlantDTO>> Get()
{
Log.Trace("PlantData: Chiamata Get");
Log.Debug("PlantData: Chiamata Get");
// serializzo i dati di PlantDTO dell'impianto richiesto
List<PlantDTO> ListRecords = await _DataService.PlantDtoGetAll();
return ListRecords;
@@ -64,7 +64,7 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")]
public async Task<PlantDTO> Get(int id)
{
Log.Trace($"PlantData: Chiamata Get | id: {id}");
Log.Debug($"PlantData: Chiamata Get | id: {id}");
// serializzo i dati di PlantDTO dell'impianto richiesto
var ListRecords = await _DataService.PlantDtoGetAll();
//seleziono plant...
+19 -19
View File
@@ -218,7 +218,7 @@ namespace GWMS.UI.Data
var dbResult = dbController.AlarmLogGetFilt(PlantId, skipRec, numRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -342,7 +342,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -505,7 +505,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -621,7 +621,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrderByCode(OrderCode);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -635,7 +635,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrderById(OrderId);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per OrderGetById: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB per OrderGetById: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -649,7 +649,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrdersFilt(CurrFilter.PlantId, CurrFilter.SupplierId, CurrFilter.TransporterId, CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.ShowClosed);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -668,7 +668,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetOrdersOpen(PlantId);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -728,7 +728,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per ParamSendGetAll: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per ParamSendGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -818,7 +818,7 @@ namespace GWMS.UI.Data
dbResult = dbController.ParamSetGet(PlantId, ParamUid);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ParamSetGetByPlant: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB per ParamSetGetByPlant: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -938,7 +938,7 @@ namespace GWMS.UI.Data
}
else
{
Log.Trace($"Veto attivo per PlantDtoGetAll: salto!");
Log.Debug($"Veto attivo per PlantDtoGetAll: salto!");
// controllo se ci sia semaforo lettura
redVeto = await distributedCache.GetAsync(cacheVetoKey);
// se scaduto da oltre 10 sec --> tolgo
@@ -958,7 +958,7 @@ namespace GWMS.UI.Data
{
rawData = Encoding.UTF8.GetString(redisDataList);
dbResult = JsonConvert.DeserializeObject<List<PlantDTO>>(rawData);
Log.Trace($"PlantDtoGetAll: lettura da cache REDIS");
Log.Debug($"PlantDtoGetAll: lettura da cache REDIS");
}
else
{
@@ -1013,7 +1013,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -1074,7 +1074,7 @@ namespace GWMS.UI.Data
// invalido i vari valori in cache
await distributedCache.RemoveAsync($"DATA:PLANTS:LastFlux:{PlantId}");
await distributedCache.RemoveAsync($"DATA:PLANTS:ListDTO");
Log.Trace($"PlantLogInsert | PlantId: {PlantId} | Completato insert {item2insert.Count} rec");
Log.Debug($"PlantLogInsert | PlantId: {PlantId} | Completato insert {item2insert.Count} rec");
}
// restituisco
@@ -1102,7 +1102,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per PlantsAnalisysGetByCode: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per PlantsAnalisysGetByCode: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -1149,7 +1149,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per PlantsList: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per PlantsList: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -1352,7 +1352,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -1392,7 +1392,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -1551,7 +1551,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetWeekPlan();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
@@ -1749,7 +1749,7 @@ namespace GWMS.UI.Data
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms");
Log.Debug($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(lastValues);
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.2406.0412</Version>
<Version>1.0.2406.0417</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+2 -2
View File
@@ -29,7 +29,7 @@
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets>
<rules>
@@ -39,7 +39,7 @@
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Debug" writeTo="fileTarget" />
</rules>
+2 -2
View File
@@ -29,7 +29,7 @@
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets>
<rules>
@@ -39,7 +39,7 @@
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Debug" writeTo="fileTarget" />
</rules>
+2 -2
View File
@@ -29,7 +29,7 @@
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets>
<rules>
@@ -39,7 +39,7 @@
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
<logger name="*" minlevel="Info" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Info" writeTo="fileTarget" />
</rules>
+3 -2
View File
@@ -24,7 +24,8 @@ namespace GWMS.UI
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information);
//logging.AddConsole();
})
.UseNLog();
@@ -40,7 +41,7 @@ namespace GWMS.UI
// sistemazione NLog da codice...
LogManager.Setup().LoadConfiguration(builder =>
{
builder.ForLogger().FilterMinLevel(NLog.LogLevel.Trace).WriteToConsole(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}");
builder.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToConsole(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}");
builder.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToFile(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}", fileName: "${basedir}/logs/App_${shortdate}.log");
});
var logger = LogManager.GetCurrentClassLogger();
-8
View File
@@ -2,16 +2,12 @@ using GWMS.Data;
using GWMS.UI.Areas.Identity;
using GWMS.UI.Data;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
@@ -19,12 +15,8 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
namespace GWMS.UI
{
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2406.0412</h4>
<h4>Versione: 1.0.2406.0417</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2406.0412
1.0.2406.0417
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2406.0412</version>
<version>1.0.2406.0417</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>