added console target to NLogConfig.xml, to help debugging on console, rather than using console.writelines.
This commit is contained in:
parent
fb068cbdf2
commit
9ba44d273e
@ -4,8 +4,12 @@
|
||||
autoReload="true">
|
||||
<targets>
|
||||
<target name="viewer" xsi:type="Chainsaw" address="udp://127.0.0.1:4000" />
|
||||
<target xsi:type="Console" name="consoleViewer"
|
||||
layout="${longdate}|${level:uppercase=true}|${message}"
|
||||
detectConsoleAvailable="true" />
|
||||
</targets>
|
||||
<rules>
|
||||
<logger name="*" minlevel="Trace" writeTo="viewer" />
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleViewer" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@ -9,14 +9,14 @@ namespace NLogLogger
|
||||
{
|
||||
public class NLogger:ILogger
|
||||
{
|
||||
private NLog.Logger _logger;
|
||||
private readonly Logger _logger;
|
||||
public NLogger()
|
||||
{
|
||||
var nlogConfigPathOption =
|
||||
ConfigurationHandler.ConfigurationHandler.GetConfiguration("NLogConfigFilePath");
|
||||
if (nlogConfigPathOption == null)
|
||||
{
|
||||
throw new ArgumentNullException("nlogConfigPath");
|
||||
throw new ArgumentNullException("nlogConfigPath", "NLogConfigFilePath missing from application config file.");
|
||||
}
|
||||
var nlogConfigPath = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), nlogConfigPathOption)).LocalPath;
|
||||
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user