LogConfigurationExtensionsUseFileAndElasticSearchFromAppSettings Method

同時使用檔案與 ElasticSearch 日誌

Definition

Namespace: eBizprise.Framework.Log.ElasticSearch
Assembly: eBizprise.Framework.Log.LogHelper.ElasticSearch (in eBizprise.Framework.Log.LogHelper.ElasticSearch.dll) Version: 25.0.3.0+6e92afb880fa099fdfe407c9aa8d1b17eaaf3625
C#
public static LogConfiguration UseFileAndElasticSearchFromAppSettings(
	this LogConfiguration logConfiguration,
	string configurationFileName = null,
	string fileSectionName = "FileLogging",
	string elasticSearchSectionName = "ElasticSearch"
)

Parameters

logConfiguration  LogConfiguration
日誌配置物件
configurationFileName  String  (Optional)
設定檔名稱 (可選)
fileSectionName  String  (Optional)
檔案日誌設定區段名稱 (可選,預設: FileLogging)
elasticSearchSectionName  String  (Optional)
設定區段名稱 (可選,預設: ElasticSearch)

Return Value

LogConfiguration
LogConfiguration 物件 (支援鏈式呼叫)

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type LogConfiguration. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Example

C#
LogHelper.Configure(config => 
{
    config.UseFileAndElasticSearchFromAppSettings(@"C:\Logs");
});

Revision History

DateVersionDescription
2025/12/0925.0.0.0新增從 appsettings 載入的組合方法
2025/12/1625.0.3.0修改為從 appsettings 載入檔案日誌設定

See Also