Microsoft Enterprise Library - 带服务器名的文件名
Microsoft Enterprise Library - Filename with Servername
早上好,
我正在尝试将服务器日志统一到一个公共网络单元上,例如
fileName="\NETWORK\App\log{ServerName}.log"
但我没有找到允许使用服务器名称的日志文件的参数
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0 listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral,
fileName="\NETWORK\App\Log\log{ServerName}.log" formatter="Text Formatter" rollInterval="Day" timeStampPattern="_yyyy-MM-dd" maxArchivedFiles="30" />
谢谢。
您可以在文件名中使用环境变量。在这种情况下 %COMPUTERNAME%:
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0 listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral,
fileName="\NETWORK\App\Log\log%COMPUTERNAME%.log" formatter="Text Formatter" rollInterval="Day" timeStampPattern="_yyyy-MM-dd" maxArchivedFiles="30" />
早上好,
我正在尝试将服务器日志统一到一个公共网络单元上,例如
fileName="\NETWORK\App\log{ServerName}.log"
但我没有找到允许使用服务器名称的日志文件的参数
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0 listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral,
fileName="\NETWORK\App\Log\log{ServerName}.log" formatter="Text Formatter" rollInterval="Day" timeStampPattern="_yyyy-MM-dd" maxArchivedFiles="30" />
谢谢。
您可以在文件名中使用环境变量。在这种情况下 %COMPUTERNAME%:
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0 listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral,
fileName="\NETWORK\App\Log\log%COMPUTERNAME%.log" formatter="Text Formatter" rollInterval="Day" timeStampPattern="_yyyy-MM-dd" maxArchivedFiles="30" />