繁体   English   中英

Logback Spring 多个配置文件

[英]Logback Spring multiple profiles

我在我的 logback 中定义了两个 Spring 配置文件,一个用于文件写入,一个仅用于控制台写入。 我希望当使用多个配置文件激活 spring 应用程序时,例如: file-logging1,file-logging2,console-logging只有最后一个控制台日志记录有效,因此没有写入文件,只有控制台。 发生的情况是 file-logging1 file-logging2 工作并写入文件但控制台上没有写入。 基本上与我的预期相反。 我怎样才能让它像控制台日志一样工作? 在我的设置下面:

<springProfile name="file-logging,file-logging1">
<logger name="com.xxx.xxx" additivity="false" level="DEBUG">
    <appender-ref ref="HTTP-DEBUG"/>
</logger>
<springProfile name="console-logging">
<logger name="org.springframework" level="DEBUG" additivity="false">
    <appender-ref ref="CONSOLE"/>
</logger>
<root level="DEBUG">
    <appender-ref ref="CONSOLE"/>
</root>

你可以加

<springProfile name="(file-logging | file-logging1) & !console-logging">
<logger name="com.xxx.xxx" additivity="false" level="DEBUG">
    <appender-ref ref="HTTP-DEBUG"/>
</logger>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM