diag(config): 临时打印 Consul 加载异常(诊断 Winton 不连接问题)
This commit is contained in:
parent
e31d2d004c
commit
23a2aa95fc
@ -34,7 +34,12 @@ builder.Configuration.AddConsul(
|
||||
options.Parser = new SimpleConfigurationParser();
|
||||
options.Optional = true; // Consul 不可用不阻断启动,回退本地 appsettings
|
||||
options.ReloadOnChange = true; // KV 变更自动刷新 IConfiguration(热重载基础)
|
||||
options.OnLoadException = ex => ex.Ignore = true; // 容错:Consul 抖动不影响应用
|
||||
// 诊断期:打印 Consul 加载异常(确认后改回 Ignore)
|
||||
options.OnLoadException = ex =>
|
||||
{
|
||||
Console.WriteLine($"[Consul] 加载异常: {ex.Exception?.GetType().Name}: {ex.Exception?.Message}");
|
||||
ex.Ignore = true;
|
||||
};
|
||||
});
|
||||
|
||||
// OTel 日志导出
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user