core: reduce log traces in info level. add start/stop log traces (#7305)

This commit is contained in:
Diego Heras 2020-02-23 21:38:59 +01:00 committed by GitHub
parent 62769325b4
commit 8c344b2917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -104,8 +104,7 @@ namespace Jackett.Common.Services
var files = existingDirectories.SelectMany(d => d.GetFiles("*.yml"));
var definitions = files.Select(file =>
{
logger.Info("Loading Cardigann definition " + file.FullName);
logger.Debug("Loading Cardigann definition " + file.FullName);
try
{
var DefinitionString = File.ReadAllText(file.FullName);
@ -147,6 +146,7 @@ namespace Jackett.Common.Services
indexers.Add(indexer.ID, indexer);
}
logger.Info("Cardigann definitions loaded: " + string.Join(", ", indexers.Keys));
}
catch (Exception ex)
{

View File

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using Autofac;
@ -115,7 +116,8 @@ namespace Jackett.Server
#if NET461
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
{
applicationLifetime.ApplicationStopping.Register(OnShutdown);
applicationLifetime.ApplicationStarted.Register(OnStarted);
applicationLifetime.ApplicationStopped.Register(OnStopped);
Helper.applicationLifetime = applicationLifetime;
app.UseResponseCompression();
@ -154,7 +156,8 @@ namespace Jackett.Server
#else
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime)
{
applicationLifetime.ApplicationStopping.Register(OnShutdown);
applicationLifetime.ApplicationStarted.Register(OnStarted);
applicationLifetime.ApplicationStopped.Register(OnStopped);
Helper.applicationLifetime = applicationLifetime;
app.UseResponseCompression();
@ -197,11 +200,12 @@ namespace Jackett.Server
}
#endif
private void OnShutdown()
private static void OnStarted()
{
//this code is called when the application stops
var elapsed = (DateTime.Now - Process.GetCurrentProcess().StartTime).TotalSeconds;
Helper.Logger.Info($"Jackett startup finished in {elapsed:0.000} s");
}
private static void OnStopped() => Helper.Logger.Info($"Jackett stopped");
}
}