哨兵log4j2 appender无法添加环境
我正在使用 Sentry log4j 附加程序(版本:5.7.1)将记录的异常发送到 Sentry。下面是 log4j2.xml 配置。
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" packages="org.apache.logging.log4j.core,io.sentry.log4j2">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<Sentry name="Sentry"
dsn="https://dsn" />
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Sentry"/>
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
现在我需要添加特定环境,以便根据 QA 和生产环境区分记录。当我添加 environment="qa" 时,它会出现以下错误。
ERROR Sentry contains an invalid element or attribute "environment"
I am using the Sentry log4j appender(version: 5.7.1) to send logged exceptions to Sentry. bellow is the log4j2.xml configuration.
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" packages="org.apache.logging.log4j.core,io.sentry.log4j2">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<Sentry name="Sentry"
dsn="https://dsn" />
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Sentry"/>
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
Now I need to add a specific environment in order to differentiate records based on the QA and Production environment. when I add environment="qa", it gives following error.
ERROR Sentry contains an invalid element or attribute "environment"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在log4j2集成中,可以使用以下方式配置“ DSN”以外的其他属性:
sentry.properties
带有内容的文件:>环境= qa
在文档中阅读更多信息: https://dtps://docs.sentry.io.io /platforms/java/configuration/
In Log4j2 integration, properties other than "dsn" can be configured either using:
sentry.properties
file with content:environment=qa
Read more in docs: https://docs.sentry.io/platforms/java/configuration/