Downgraded some logs

This commit is contained in:
kay.one 2011-04-24 20:51:18 -07:00
parent 80d47e611c
commit d3471b5bbb
5 changed files with 37 additions and 16 deletions

3
.gitignore vendored
View File

@ -31,4 +31,5 @@ _ReSharper*/
[Ll]ogs/ [Ll]ogs/
/[Pp]ackage/ /[Pp]ackage/
#NZBDrone specific #NZBDrone specific
*.db *.db
*Web.Publish.xml

View File

@ -70,7 +70,7 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
if (_isRunning) if (_isRunning)
{ {
Logger.Info("Another instance of this job is already running. Ignoring request."); Logger.Warn("Another instance of this job is already running. Ignoring request.");
return false; return false;
} }
_isRunning = true; _isRunning = true;
@ -78,7 +78,6 @@ namespace NzbDrone.Core.Providers.Jobs
try try
{ {
Logger.Trace("Getting list of jobs needing to be executed");
var pendingJobs = All().Where( var pendingJobs = All().Where(
t => t.Enable && t => t.Enable &&
@ -114,16 +113,14 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
if (_isRunning) if (_isRunning)
{ {
Logger.Info("Another instance of this job is already running. Ignoring request."); Logger.Warn("Another job is already running. Ignoring request.");
return false; return false;
} }
_isRunning = true; _isRunning = true;
} }
Logger.Info("User has requested a manual execution of {0}", jobType.Name);
if (_jobThread == null || !_jobThread.IsAlive) if (_jobThread == null || !_jobThread.IsAlive)
{ {
Logger.Debug("Initializing background thread"); Logger.Trace("Initializing background thread");
ThreadStart starter = () => ThreadStart starter = () =>
{ {
@ -170,7 +167,7 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
try try
{ {
Logger.Info("Starting job '{0}'. Last execution {1}", settings.Name, settings.LastExecution); Logger.Debug("Starting job '{0}'. Last execution {1}", settings.Name, settings.LastExecution);
settings.LastExecution = DateTime.Now; settings.LastExecution = DateTime.Now;
var sw = Stopwatch.StartNew(); var sw = Stopwatch.StartNew();
@ -180,7 +177,7 @@ namespace NzbDrone.Core.Providers.Jobs
settings.Success = true; settings.Success = true;
sw.Stop(); sw.Stop();
Logger.Info("Job '{0}' successfully completed in {1} seconds", timerClass.Name, sw.Elapsed.Minutes, Logger.Debug("Job '{0}' successfully completed in {1} seconds", timerClass.Name, sw.Elapsed.Minutes,
sw.Elapsed.Seconds); sw.Elapsed.Seconds);
} }
catch (Exception e) catch (Exception e)
@ -201,7 +198,7 @@ namespace NzbDrone.Core.Providers.Jobs
/// </summary> /// </summary>
public virtual void Initialize() public virtual void Initialize()
{ {
Logger.Info("Initializing jobs. Count {0}", _jobs.Count()); Logger.Debug("Initializing jobs. Count {0}", _jobs.Count());
var currentTimer = All(); var currentTimer = All();
foreach (var timer in _jobs) foreach (var timer in _jobs)

View File

@ -44,7 +44,8 @@ namespace NzbDrone
IISProcess.StartInfo.CreateNoWindow = true; IISProcess.StartInfo.CreateNoWindow = true;
IISProcess.OutputDataReceived += (OnDataReceived); IISProcess.OutputDataReceived += (OnOutputDataReceived);
IISProcess.ErrorDataReceived += (OnErrorDataReceived);
//Set Variables for the config file. //Set Variables for the config file.
Environment.SetEnvironmentVariable("NZBDRONE_PATH", Config.ProjectRoot); Environment.SetEnvironmentVariable("NZBDRONE_PATH", Config.ProjectRoot);
@ -60,6 +61,9 @@ namespace NzbDrone
Logger.Info("Starting process. [{0}]", IISProcess.StartInfo.FileName); Logger.Info("Starting process. [{0}]", IISProcess.StartInfo.FileName);
IISProcess.Start(); IISProcess.Start();
IISProcess.BeginErrorReadLine(); IISProcess.BeginErrorReadLine();
@ -73,6 +77,14 @@ namespace NzbDrone
return IISProcess; return IISProcess;
} }
private static void OnErrorDataReceived(object sender, DataReceivedEventArgs e)
{
if (e == null || String.IsNullOrWhiteSpace(e.Data))
return;
IISLogger.Error(e.Data);
}
internal static void StopServer() internal static void StopServer()
{ {
KillProcess(IISProcess); KillProcess(IISProcess);
@ -82,7 +94,7 @@ namespace NzbDrone
{ {
string processPath = process.MainModule.FileName; string processPath = process.MainModule.FileName;
Logger.Info("[{0}]IIS Process found. Path:{1}", process.Id, processPath); Logger.Info("[{0}]IIS Process found. Path:{1}", process.Id, processPath);
if (CleanPath(processPath) == CleanPath(IISExe)) if (NormalizePath(processPath) == NormalizePath(IISExe))
{ {
Logger.Info("[{0}]Process is considered orphaned.", process.Id); Logger.Info("[{0}]Process is considered orphaned.", process.Id);
KillProcess(process); KillProcess(process);
@ -124,7 +136,7 @@ namespace NzbDrone
} }
} }
private static void OnDataReceived(object s, DataReceivedEventArgs e) private static void OnOutputDataReceived(object s, DataReceivedEventArgs e)
{ {
if (e == null || String.IsNullOrWhiteSpace(e.Data) || e.Data.StartsWith("Request started:") || if (e == null || String.IsNullOrWhiteSpace(e.Data) || e.Data.StartsWith("Request started:") ||
e.Data.StartsWith("Request ended:") || e.Data == ("IncrementMessages called")) e.Data.StartsWith("Request ended:") || e.Data == ("IncrementMessages called"))
@ -167,9 +179,19 @@ namespace NzbDrone
} }
} }
private static string CleanPath(string path) public static string NormalizePath(string path)
{ {
return path.ToLower().Replace("\\", "").Replace("//", "//"); if (String.IsNullOrWhiteSpace(path))
throw new ArgumentException("Path can not be null or empty");
var info = new FileInfo(path);
if (info.FullName.StartsWith(@"\\")) //UNC
{
return info.FullName.TrimEnd('/', '\\', ' ');
}
return info.FullName.Trim('/', '\\', ' ').ToLower();
} }

View File

@ -13,6 +13,7 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
@ -25,7 +26,6 @@
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>

View File

@ -21,6 +21,7 @@ namespace NzbDrone
AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e)); AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e));
AppDomain.CurrentDomain.ProcessExit += ProgramExited; AppDomain.CurrentDomain.ProcessExit += ProgramExited;
AppDomain.CurrentDomain.DomainUnload += ProgramExited; AppDomain.CurrentDomain.DomainUnload += ProgramExited;
Process.GetCurrentProcess().EnableRaisingEvents = true;
Process.GetCurrentProcess().Exited += ProgramExited; Process.GetCurrentProcess().Exited += ProgramExited;
Config.ConfigureNlog(); Config.ConfigureNlog();