fixed path.combine null exception if the config doesnt exist
This commit is contained in:
parent
ebfced87ee
commit
1babd514ce
@ -13,11 +13,12 @@ namespace NLogLogger
|
|||||||
private NLog.Logger _logger;
|
private NLog.Logger _logger;
|
||||||
public NLogger()
|
public NLogger()
|
||||||
{
|
{
|
||||||
var nlogConfigPath = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), ConfigurationManager.AppSettings["NLogConfigFilePath"])).LocalPath;
|
var nlogConfigPathOption = ConfigurationManager.AppSettings["NLogConfigFilePath"];
|
||||||
if (nlogConfigPath == null)
|
if (nlogConfigPathOption == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("nlogConfigPath");
|
throw new ArgumentNullException("nlogConfigPath");
|
||||||
}
|
}
|
||||||
|
var nlogConfigPath = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), nlogConfigPathOption)).LocalPath;
|
||||||
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath);
|
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath);
|
||||||
_logger = LogManager.GetLogger("");
|
_logger = LogManager.GetLogger("");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user