-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
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 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.
Reference implementation: https://github.com/NLog/NLog/blob/dev/src/NLog/Targets/MailTarget.cs
Metadata
Metadata
Assignees
Labels
No labels