mirror of https://github.com/winsw/winsw
Include logger names in logs
parent
d771e474dc
commit
2363bf0ffa
|
@ -5,6 +5,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using WinSW.Logging;
|
||||||
using WinSW.Util;
|
using WinSW.Util;
|
||||||
|
|
||||||
namespace WinSW
|
namespace WinSW
|
||||||
|
@ -22,7 +23,7 @@ namespace WinSW
|
||||||
Basic
|
Basic
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly ILog Logger = LogManager.GetLogger(typeof(Download));
|
private static readonly ILog Logger = LogManager.GetLogger(LoggerNames.Service);
|
||||||
|
|
||||||
public readonly string From;
|
public readonly string From;
|
||||||
public readonly string To;
|
public readonly string To;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using WinSW.Logging;
|
||||||
|
|
||||||
namespace WinSW.Extensions
|
namespace WinSW.Extensions
|
||||||
{
|
{
|
||||||
|
@ -11,7 +12,7 @@ namespace WinSW.Extensions
|
||||||
|
|
||||||
public XmlServiceConfig ServiceConfig { get; }
|
public XmlServiceConfig ServiceConfig { get; }
|
||||||
|
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(WinSWExtensionManager));
|
private static readonly ILog Log = LogManager.GetLogger(LoggerNames.Service);
|
||||||
|
|
||||||
public WinSWExtensionManager(XmlServiceConfig serviceConfig)
|
public WinSWExtensionManager(XmlServiceConfig serviceConfig)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace WinSW.Logging
|
||||||
|
{
|
||||||
|
internal static class LoggerNames
|
||||||
|
{
|
||||||
|
internal const string Console = "console";
|
||||||
|
internal const string Service = "service";
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using WinSW.Logging;
|
||||||
using WinSW.Native;
|
using WinSW.Native;
|
||||||
using static WinSW.Native.ConsoleApis;
|
using static WinSW.Native.ConsoleApis;
|
||||||
using static WinSW.Native.ProcessApis;
|
using static WinSW.Native.ProcessApis;
|
||||||
|
@ -12,7 +13,7 @@ namespace WinSW.Util
|
||||||
{
|
{
|
||||||
public static class ProcessExtensions
|
public static class ProcessExtensions
|
||||||
{
|
{
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(ProcessExtensions));
|
private static readonly ILog Log = LogManager.GetLogger(LoggerNames.Service);
|
||||||
|
|
||||||
public static void StopTree(this Process process, int millisecondsTimeout)
|
public static void StopTree(this Process process, int millisecondsTimeout)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace WinSW
|
||||||
|
|
||||||
private static readonly int AdditionalStopTimeout = 1_000;
|
private static readonly int AdditionalStopTimeout = 1_000;
|
||||||
|
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(WrapperService));
|
private static readonly ILog Log = LogManager.GetLogger(LoggerNames.Service);
|
||||||
|
|
||||||
private readonly XmlServiceConfig config;
|
private readonly XmlServiceConfig config;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace WinSW
|
||||||
{
|
{
|
||||||
private const string NoPipe = "-";
|
private const string NoPipe = "-";
|
||||||
|
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
|
private static readonly ILog Log = LogManager.GetLogger(LoggerNames.Console);
|
||||||
|
|
||||||
internal static Action<Exception, InvocationContext>? TestExceptionHandler;
|
internal static Action<Exception, InvocationContext>? TestExceptionHandler;
|
||||||
internal static XmlServiceConfig? TestConfig;
|
internal static XmlServiceConfig? TestConfig;
|
||||||
|
@ -1095,7 +1095,7 @@ namespace WinSW
|
||||||
{
|
{
|
||||||
Name = "Wrapper console log",
|
Name = "Wrapper console log",
|
||||||
Threshold = consoleLogLevel,
|
Threshold = consoleLogLevel,
|
||||||
Layout = new PatternLayout("%date{ABSOLUTE} - %message%newline"),
|
Layout = new PatternLayout("%message%newline"),
|
||||||
};
|
};
|
||||||
consoleAppender.ActivateOptions();
|
consoleAppender.ActivateOptions();
|
||||||
|
|
||||||
|
@ -1139,7 +1139,7 @@ namespace WinSW
|
||||||
Name = "Wrapper file log",
|
Name = "Wrapper file log",
|
||||||
Threshold = fileLogLevel,
|
Threshold = fileLogLevel,
|
||||||
LockingModel = new FileAppender.MinimalLock(),
|
LockingModel = new FileAppender.MinimalLock(),
|
||||||
Layout = new PatternLayout("%date %-5level - %message%newline"),
|
Layout = new PatternLayout("%date{yyyy-MM-ddTHH:mm:ss.fff} %-5level %logger - %message%newline"),
|
||||||
};
|
};
|
||||||
fileAppender.ActivateOptions();
|
fileAppender.ActivateOptions();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue