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">
|
autoReload="true">
|
||||||
<targets>
|
<targets>
|
||||||
<target name="viewer" xsi:type="Chainsaw" address="udp://127.0.0.1:4000" />
|
<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>
|
</targets>
|
||||||
<rules>
|
<rules>
|
||||||
<logger name="*" minlevel="Trace" writeTo="viewer" />
|
<logger name="*" minlevel="Trace" writeTo="viewer" />
|
||||||
|
<logger name="*" minlevel="Trace" writeTo="consoleViewer" />
|
||||||
</rules>
|
</rules>
|
||||||
</nlog>
|
</nlog>
|
||||||
@ -9,14 +9,14 @@ namespace NLogLogger
|
|||||||
{
|
{
|
||||||
public class NLogger:ILogger
|
public class NLogger:ILogger
|
||||||
{
|
{
|
||||||
private NLog.Logger _logger;
|
private readonly Logger _logger;
|
||||||
public NLogger()
|
public NLogger()
|
||||||
{
|
{
|
||||||
var nlogConfigPathOption =
|
var nlogConfigPathOption =
|
||||||
ConfigurationHandler.ConfigurationHandler.GetConfiguration("NLogConfigFilePath");
|
ConfigurationHandler.ConfigurationHandler.GetConfiguration("NLogConfigFilePath");
|
||||||
if (nlogConfigPathOption == null)
|
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;
|
var nlogConfigPath = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), nlogConfigPathOption)).LocalPath;
|
||||||
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath);
|
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user