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

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Text; using System.Text;
using Autofac; using Autofac;
@@ -115,7 +116,8 @@ namespace Jackett.Server
#if NET461 #if NET461
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime) public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
{ {
applicationLifetime.ApplicationStopping.Register(OnShutdown); applicationLifetime.ApplicationStarted.Register(OnStarted);
applicationLifetime.ApplicationStopped.Register(OnStopped);
Helper.applicationLifetime = applicationLifetime; Helper.applicationLifetime = applicationLifetime;
app.UseResponseCompression(); app.UseResponseCompression();
@@ -154,7 +156,8 @@ namespace Jackett.Server
#else #else
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime) public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime)
{ {
applicationLifetime.ApplicationStopping.Register(OnShutdown); applicationLifetime.ApplicationStarted.Register(OnStarted);
applicationLifetime.ApplicationStopped.Register(OnStopped);
Helper.applicationLifetime = applicationLifetime; Helper.applicationLifetime = applicationLifetime;
app.UseResponseCompression(); app.UseResponseCompression();
@@ -197,11 +200,12 @@ namespace Jackett.Server
} }
#endif #endif
private static void OnStarted()
private void OnShutdown()
{ {
//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");
} }
} }