You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the nlog.config for target: serverUrl="${var:serverUrl}"
This var is set at runtime, on the code when ASPCore startup, e.g NLog.LogManager.Configuration.Variables["serverUrl"] = xxx
The same to other dynamic value mechanisms.
Problem
Error in internalLog: Exception: NLog.NLogConfigurationException: SplunkHttpEventCollector ServerUrl is not set!
We're checking the ServerUrl in InitializeTarget().
At this time, that var is not available yet, because it is set later at runtime.
Hence, exception is thrown and _hecSender is not initialized.
Proposal
Create _hecSender when needed, not at InitializeTarget.
Use case
I have the nlog.config for target:
serverUrl="${var:serverUrl}"
This var is set at runtime, on the code when ASPCore startup, e.g
NLog.LogManager.Configuration.Variables["serverUrl"] = xxx
The same to other dynamic value mechanisms.
Problem
Error in internalLog:
Exception: NLog.NLogConfigurationException: SplunkHttpEventCollector ServerUrl is not set!
We're checking the
ServerUrl
inInitializeTarget()
.At this time, that var is not available yet, because it is set later at runtime.
Hence, exception is thrown and
_hecSender
is not initialized.Proposal
Create
_hecSender
when needed, not atInitializeTarget
.Reference implementation: https://github.com/NLog/NLog/blob/dev/src/NLog/Targets/MailTarget.cs
The text was updated successfully, but these errors were encountered: