NLog: using appsettings in nlog.config not working
NLog version 4.5.11
Platform: .Net 4.7.2
<nlog autoReload="true" throwExceptions="true">
<extensions> <add assembly="NLog.Gelf" /> <add assembly="NLog.Extended" /> </extensions> <targets><target name="GelfHttp" type="GelfHttp" serverUrl="${appsetting:GraylogEndpoint}" facility="myfacility"/>
</targets>
<rules>
<logger name="*" minLevel="Trace" appendTo="GelfHttp"/>
</rules>
</nlog>
- What is the current result? the serverUrl is not being updated
- What is the expected result? the serverUrl should point to my endpoint and log files
- Did you checked the Internal log? 2018-11-08 13:01:53.8171 Error Unable to send logging event to remote host ${appsetting:GraylogEndpoint} Exception: System.UriFormatException: Invalid URI: The URI scheme is not valid. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
- Please post full exception details (message, stacktrace, inner exceptions) System.NullReferenceException: Object reference not set to an instance of an object. at NLog.Config.LoggingConfiguration.ExpandSimpleVariables(String input) at NLog.Config.XmlLoggingConfiguration.SetPropertyFromElement(Object o, NLogXmlElement element) at NLog.Config.XmlLoggingConfiguration.ParseTargetElement(Target target, NLogXmlElement targetElement, Dictionary`2 typeNameToDefaultTargetParameters) at NLog.Config.XmlLoggingConfiguration.ParseTargetsElement(NLogXmlElement targetsElement) at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(NLogXmlElement nlogElement, String filePath, Boolean autoReloadDefault) at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content, String filePath, Boolean autoReloadDefault) at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors) — End of inner ExceptionDetail stack trace — at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors) at NLog.Config.XmlLoggingConfiguration…ctor(String fileName, Boolean ignoreErrors, LogFactory logFactory) at NLog.LogFactory.LoadXmlLoggingConfiguration(String configFile) at NLog.LogFactory.TryLoadLoggingConfiguration(String configFile, LoggingConfiguration& config) at NLog.LogFactory.TryLoadFromFilePaths() at NLog.LogFactory.get_Configuration() at NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey) at NLog.LogFactory.GetLogger(String name) at NLog.LogManager.GetCurrentClassLogger() at Adapt2.ISO.ISOService.CommonService…cctor() — End of inner ExceptionDetail stack trace — at Adapt2.ISO.ISOService.CommonService.GetEnvironment() at SyncInvokeGetEnvironment(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)}
- Are there any workarounds? no
- Is there a version in which it did work? no
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 20 (10 by maintainers)
I used this method