|
20 | 20 | using Microsoft.Azure.WebJobs.Host.Listeners;
|
21 | 21 | using Microsoft.Azure.WebJobs.Logging;
|
22 | 22 | using Microsoft.Azure.WebJobs.Script.Config;
|
| 23 | +using Microsoft.Azure.WebJobs.Script.Configuration; |
23 | 24 | using Microsoft.Azure.WebJobs.Script.Description;
|
24 | 25 | using Microsoft.Azure.WebJobs.Script.Diagnostics;
|
25 | 26 | using Microsoft.Azure.WebJobs.Script.Eventing;
|
@@ -51,6 +52,7 @@ public class ScriptHost : JobHost, IScriptJobHost
|
51 | 52 | private readonly Stopwatch _stopwatch = new Stopwatch();
|
52 | 53 | private readonly string _currentRuntimelanguage;
|
53 | 54 | private readonly IOptions<JobHostOptions> _hostOptions;
|
| 55 | + private readonly IConfiguration _configuration; |
54 | 56 | private readonly ScriptTypeLocator _typeLocator;
|
55 | 57 | private readonly IDebugStateProvider _debugManager;
|
56 | 58 | private readonly ICollection<IScriptBindingProvider> _bindingProviders;
|
@@ -101,6 +103,7 @@ public ScriptHost(IOptions<JobHostOptions> options,
|
101 | 103 |
|
102 | 104 | _instanceId = Guid.NewGuid().ToString();
|
103 | 105 | _hostOptions = options;
|
| 106 | + _configuration = configuration; |
104 | 107 | _storageConnectionString = configuration.GetWebJobsConnectionString(ConnectionStringNames.Storage);
|
105 | 108 | _distributedLockManager = distributedLockManager;
|
106 | 109 | _functionMetadataManager = functionMetadataManager;
|
@@ -271,6 +274,12 @@ public async Task InitializeAsync()
|
271 | 274 |
|
272 | 275 | private async Task LogInitializationAsync()
|
273 | 276 | {
|
| 277 | + // If the host id is explicitly set, emit a warning that this could cause issues and shouldn't be done |
| 278 | + if (_configuration[ConfigurationSectionNames.HostIdPath] != null) |
| 279 | + { |
| 280 | + _logger.LogWarning("Host id explicitly set in configuration. This is not a recommended configuration and may lead to unexpected behavior."); |
| 281 | + } |
| 282 | + |
274 | 283 | string extensionVersion = _environment.GetEnvironmentVariable(EnvironmentSettingNames.FunctionsExtensionVersion);
|
275 | 284 | string hostId = await _hostIdProvider.GetHostIdAsync(CancellationToken.None);
|
276 | 285 | string message = $"Starting Host (HostId={hostId}, InstanceId={InstanceId}, Version={Version}, ProcessId={Process.GetCurrentProcess().Id}, AppDomainId={AppDomain.CurrentDomain.Id}, Debug={InDebugMode}, FunctionsExtensionVersion={extensionVersion})";
|
|
0 commit comments