#199 Les logs des repository sont desormais disponibles sur la console et dans grafana pour faciliter le debuggage.
This commit is contained in:
@@ -81,16 +81,8 @@ public class ArtisteController : Controller
|
|||||||
Biographie = model.Biographie,
|
Biographie = model.Biographie,
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
this.artisteRepository.Add(artiste);
|
||||||
{
|
this.logger.LogInformation("Création d'un nouvel artiste: {Nom}", artiste.Nom);
|
||||||
this.artisteRepository.Add(artiste);
|
|
||||||
this.logger.LogInformation("Création d'un nouvel artiste: {Nom}", artiste.Nom);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
this.logger.LogError(ex, "Erreur lors de la création de l'artiste: {Nom}", artiste.Nom);
|
|
||||||
return this.View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Renvoyer sur la page Index.
|
// Renvoyer sur la page Index.
|
||||||
return this.RedirectToAction("Index");
|
return this.RedirectToAction("Index");
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Webzine.Repository": "Debug"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Webzine": {
|
"Webzine": {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
<rules>
|
<rules>
|
||||||
<!-- Vos logs d'application en Debug+ -->
|
<!-- Vos logs d'application en Debug+ -->
|
||||||
<logger name="Webzine.WebApplication.*" minlevel="Info" writeTo="allfile,ownfile-web,console" />
|
<logger name="Webzine.WebApplication.*" minlevel="Info" writeTo="allfile,ownfile-web,console" />
|
||||||
|
<logger name="Webzine.Repository.*" minlevel="Debug" writeTo="allfile,ownfile-web,console" />
|
||||||
|
|
||||||
<!-- Logs Microsoft en Warning+ sauf Hosting.Lifetime -->
|
<!-- Logs Microsoft en Warning+ sauf Hosting.Lifetime -->
|
||||||
<logger name="Microsoft.*" minlevel="Warn" writeTo="allfile" final="true" />
|
<logger name="Microsoft.*" minlevel="Warn" writeTo="allfile" final="true" />
|
||||||
|
|||||||
Reference in New Issue
Block a user