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;
|
||||
public NLogger()
|
||||
{
|
||||
var nlogConfigPath = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), ConfigurationManager.AppSettings["NLogConfigFilePath"])).LocalPath;
|
||||
if (nlogConfigPath == null)
|
||||
var nlogConfigPathOption = ConfigurationManager.AppSettings["NLogConfigFilePath"];
|
||||
if (nlogConfigPathOption == null)
|
||||
{
|
||||
throw new ArgumentNullException("nlogConfigPath");
|
||||
}
|
||||
var nlogConfigPath = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), nlogConfigPathOption)).LocalPath;
|
||||
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath);
|
||||
_logger = LogManager.GetLogger("");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user