You've already forked Sonarr
mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-11-06 09:19:38 +02:00
Cleaned up logging code
Added udp logging Added SyncProvider to provide async long running tasks Refactored SyncSeries to SyncProvider Episode Info is now fetched automatically Optimized RefreshEpisodeInfo for better performance
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
|
||||
namespace NzbDrone
|
||||
{
|
||||
@@ -33,41 +29,11 @@ namespace NzbDrone
|
||||
|
||||
return _projectRoot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal static void ConfigureNlog()
|
||||
{
|
||||
var config = new LoggingConfiguration();
|
||||
|
||||
var debuggerTarget = new DebuggerTarget
|
||||
{
|
||||
Layout = "${logger}: ${message}"
|
||||
};
|
||||
|
||||
|
||||
var consoleTarget = new ColoredConsoleTarget
|
||||
{
|
||||
Layout = "${logger}: ${message}"
|
||||
};
|
||||
|
||||
|
||||
config.AddTarget("debugger", debuggerTarget);
|
||||
config.AddTarget("console", consoleTarget);
|
||||
//config.AddTarget("file", fileTarget);
|
||||
|
||||
// Step 3. Set target properties
|
||||
// Step 4. Define rules
|
||||
//LoggingRule fileRule = new LoggingRule("*", LogLevel.Trace, fileTarget);
|
||||
var debugRule = new LoggingRule("*", LogLevel.Trace, debuggerTarget);
|
||||
var consoleRule = new LoggingRule("*", LogLevel.Trace, consoleTarget);
|
||||
|
||||
//config.LoggingRules.Add(fileRule);
|
||||
config.LoggingRules.Add(debugRule);
|
||||
config.LoggingRules.Add(consoleRule);
|
||||
|
||||
// Step 5. Activate the configuration
|
||||
LogManager.Configuration = config;
|
||||
LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(ProjectRoot, "NZBDrone.Web\\log.config"), false);
|
||||
}
|
||||
|
||||
internal static int Port
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace NzbDrone
|
||||
IISProcess = new Process();
|
||||
|
||||
IISProcess.StartInfo.FileName = IISExe;
|
||||
IISProcess.StartInfo.Arguments = "/config:IISExpress\\Appserver\\applicationhost.config";
|
||||
IISProcess.StartInfo.Arguments = "/config:IISExpress\\Appserver\\applicationhost.config /trace:i";
|
||||
IISProcess.StartInfo.WorkingDirectory = Config.ProjectRoot;
|
||||
|
||||
IISProcess.StartInfo.UseShellExecute = false;
|
||||
@@ -37,9 +37,13 @@ namespace NzbDrone
|
||||
IISProcess.StartInfo.RedirectStandardError = true;
|
||||
IISProcess.StartInfo.CreateNoWindow = true;
|
||||
|
||||
IISProcess.OutputDataReceived += ((s, e) => IISLogger.Trace(e.Data));
|
||||
|
||||
IISProcess.OutputDataReceived += (OnDataReceived);
|
||||
|
||||
IISProcess.ErrorDataReceived += ((s, e) => IISLogger.Fatal(e.Data));
|
||||
|
||||
|
||||
|
||||
//Set Variables for the config file.
|
||||
Environment.SetEnvironmentVariable("NZBDRONE_PATH", Config.ProjectRoot);
|
||||
UpdateIISConfig();
|
||||
@@ -52,6 +56,14 @@ namespace NzbDrone
|
||||
return IISProcess;
|
||||
}
|
||||
|
||||
private static void OnDataReceived(object s, DataReceivedEventArgs e)
|
||||
{
|
||||
if (e == null || e.Data == null || e.Data.StartsWith("Request started:") || e.Data.StartsWith("Request ended:") || e.Data == ("IncrementMessages called"))
|
||||
return;
|
||||
|
||||
IISLogger.Trace(e.Data);
|
||||
}
|
||||
|
||||
internal static void StopIIS()
|
||||
{
|
||||
KillProcess(IISProcess);
|
||||
@@ -59,11 +71,9 @@ namespace NzbDrone
|
||||
|
||||
internal static void KillOrphaned()
|
||||
{
|
||||
Logger.Trace("================================================");
|
||||
Logger.Info("Finding orphaned IIS Processes.");
|
||||
foreach (var process in Process.GetProcessesByName("IISExpress"))
|
||||
{
|
||||
Logger.Trace("-------------------------");
|
||||
string processPath = process.MainModule.FileName;
|
||||
Logger.Info("[{0}]IIS Process found. Path:{1}", process.Id, processPath);
|
||||
if (CleanPath(processPath) == CleanPath(IISExe))
|
||||
@@ -75,13 +85,9 @@ namespace NzbDrone
|
||||
{
|
||||
Logger.Info("[{0}]Process has a different start-up path. skipping.", process.Id);
|
||||
}
|
||||
Logger.Trace("-------------------------");
|
||||
}
|
||||
Logger.Trace("================================================");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void KillProcess(Process process)
|
||||
{
|
||||
if (process == null) return;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Exceptioneer.WindowsFormsClient;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
@@ -16,8 +17,12 @@ namespace NzbDrone
|
||||
|
||||
static void Main()
|
||||
{
|
||||
Logger.Info(Process.GetCurrentProcess().Id);
|
||||
|
||||
try
|
||||
{
|
||||
Thread.CurrentThread.Name = "Host";
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e));
|
||||
AppDomain.CurrentDomain.ProcessExit += ProgramExited;
|
||||
AppDomain.CurrentDomain.DomainUnload += ProgramExited;
|
||||
@@ -35,8 +40,8 @@ namespace NzbDrone
|
||||
#if DEBUG
|
||||
//Manually Attach debugger to IISExpress
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
ProcessAttacher.Attach();
|
||||
{
|
||||
ProcessAttacher.Attach();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,10 +5,12 @@ using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NzbDrone.Console")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyTitle("NZBDrone")]
|
||||
[assembly: AssemblyDescription("NZBDrone")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("NzbDrone.Console")]
|
||||
[assembly: AssemblyCompany("www.nzbdrone.com")]
|
||||
[assembly: AssemblyProduct("NZBDrone")]
|
||||
[assembly: AssemblyCopyright("GNU General Public v3")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -31,5 +33,4 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
||||
[assembly: AssemblyVersion("0.2.0.*")]
|
||||
|
||||
Reference in New Issue
Block a user