我们有一个场景,即一个应用程序的多个预发布版本在同一环境中运行。我们看到的问题是,由于我们EventSource
的名称/guid 相同,我们无法区分日志。
是否可以通过 config 或在运行时以其他方式配置 EventSource 的名称/guid?
我们目前有一个单一构建部署管道,所以我认为构建时解决方案不适合我们。
我们有一个场景,即一个应用程序的多个预发布版本在同一环境中运行。我们看到的问题是,由于我们EventSource
的名称/guid 相同,我们无法区分日志。
是否可以通过 config 或在运行时以其他方式配置 EventSource 的名称/guid?
我们目前有一个单一构建部署管道,所以我认为构建时解决方案不适合我们。
That is not supported. Some teams do the following: add additional parameter to each event to pass a version/build identifier.
Another potential option would be to create a pre-build task to alter the source code (EventSource implementation) to assign different GUID each build. But in this case that would be hard to work with those logs.
我们最终通过进程 id 过滤了 observable:
int currentProcessId = Process.GetCurrentProcess().Id;
new ObservableEventListener()
.Where(ev => ev.ProcessId == currentProcessId)
.LogToRollingFlatFile(...);
显然,一旦我们退出进程,这将不起作用,但现在没关系。