[英]Environment variable treated as string in app.config
I'm not able to use any environment variable when declaring listener fileName for Microsoft Enterprise Library - logging block 声明Microsoft Enterprise Library的侦听器fileName时,无法使用任何环境变量-日志记录块
It is getting treated as a string "I find a folder with the name %temp% inside next to exe file! 它被视为字符串“我在exe文件旁边找到一个名称为%temp%的文件夹!
I have tried multiple variables all with the same results, I have tried using ${} format and same result! 我已经尝试了多个具有相同结果的变量,也曾尝试使用$ {}格式和相同结果!
<add fileName="%ProgramData%\\errors.log" header="----------------" footer="----------------" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, OceanEhr.Logging" traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener" name="UserLog"/>
Microsoft documentation mentions that we can use variables in fileName, so no idea what I'm missing Microsoft文档提到我们可以在fileName中使用变量,所以不知道我缺少了什么
Source: https://docs.microsoft.com/en-us/previous-versions/msp-np/ff664768(v=pandp.50) 来源: https : //docs.microsoft.com/zh-cn/previous-versions/msp-np/ff664768(v=pandp.50)
也许尝试其他环境变量,例如%APPDATA%
或%ALLUSERSPROFILE%
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.