拦截来自 Ant 的 Commons 日志记录

发布于 2024-09-06 23:19:57 字数 1407 浏览 2 评论 0原文

我试图弄清楚如何使 org.apache.commons.digester.Digester 更安静。我在构建时使用 Ant 将 JRXML 文件编译为 jasper 文件(JasperReports 报告)。我在类路径上有 logback.xml 和 slf4j 和 jcl-over-slf4j 可用。我只是无法弄清楚接线。

问题是我有 200 多个报告,在编译它们时,Digester 正在记录 DEBUG 消息,导致 55M 日志文件和太多噪音,无法找到任何实际错误。我真的只是想抑制 DEBUG 消息。任何帮助将不胜感激。

日志片段:

[jrc] 09:56:51.525 [main] DEBUG o.a.commons.digester.Digester.sax - setDocumentLocator(org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy@543a586d)
[jrc] 09:56:51.525 [main] DEBUG o.a.commons.digester.Digester.sax - startDocument()
[jrc] 09:56:51.998 [main] DEBUG o.a.commons.digester.Digester.sax - startElement(,jasperReport,jasperReport)
[jrc] 09:56:51.998 [main] DEBUG org.apache.commons.digester.Digester -   Pushing body text ''
[jrc] 09:56:51.999 [main] DEBUG org.apache.commons.digester.Digester -   New match='jasperReport'
[jrc] 09:56:51.999 [main] DEBUG org.apache.commons.digester.Digester -   Fire begin() for FactoryCreateRule

Ant 片段:

<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask" classpathref="jasper.reports.path"/>
<jrc tempdir="${temp.dir}" destdir="${project.classes}">
<classpath refid="libs.path" />
<classpath refid="compile.class.path" />
<src>
<fileset dir="${project.jasper.dir}">
<include name="*.jrxml"/>
</fileset>
</src>
</jrc>

I'm trying to figure out how to make org.apache.commons.digester.Digester be quieter. I am compiling JRXML files into jasper files (JasperReports reports) at build time using Ant. I have a logback.xml and slf4j and jcl-over-slf4j available on the classpath. I just can't figure out the wiring.

The problem is I have 200+ reports and when compiling them, the Digester is logging DEBUG messages, causing 55M log files and too much noise to find any actual errors. I really just want to suppress the DEBUG messages. Any help would be most appreciated.

Log snippet:

[jrc] 09:56:51.525 [main] DEBUG o.a.commons.digester.Digester.sax - setDocumentLocator(org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy@543a586d)
[jrc] 09:56:51.525 [main] DEBUG o.a.commons.digester.Digester.sax - startDocument()
[jrc] 09:56:51.998 [main] DEBUG o.a.commons.digester.Digester.sax - startElement(,jasperReport,jasperReport)
[jrc] 09:56:51.998 [main] DEBUG org.apache.commons.digester.Digester -   Pushing body text ''
[jrc] 09:56:51.999 [main] DEBUG org.apache.commons.digester.Digester -   New match='jasperReport'
[jrc] 09:56:51.999 [main] DEBUG org.apache.commons.digester.Digester -   Fire begin() for FactoryCreateRule

Ant snippet:

<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask" classpathref="jasper.reports.path"/>
<jrc tempdir="${temp.dir}" destdir="${project.classes}">
<classpath refid="libs.path" />
<classpath refid="compile.class.path" />
<src>
<fileset dir="${project.jasper.dir}">
<include name="*.jrxml"/>
</fileset>
</src>
</jrc>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羅雙樹 2024-09-13 23:19:57

如果您的类路径上有 jcl-over-slf4j jar、slf4j jar 和 logback jar,那么类路径中包含 logback.xml 文件也应该连接公共日志记录以通过 logback 运行。包含如下内容将降低日志级别并最小化输出。

<logger name="org.apache.commons.digester" additivity="false">
<level value="ERROR" />
<appender-ref ref="RootConsoleAppender" />
</logger>
<logger name="net.sf.jasperreports.engine" additivity="false">
<level value="ERROR" />
<appender-ref ref="RootConsoleAppender" />
</logger>

If you have the jcl-over-slf4j jar, the slf4j jar, and the logback jar on your classpath, including a logback.xml file in the classpath also should wire up the commons logging to run through logback. Including something like the below will reduce the log level and minimize output.

<logger name="org.apache.commons.digester" additivity="false">
<level value="ERROR" />
<appender-ref ref="RootConsoleAppender" />
</logger>
<logger name="net.sf.jasperreports.engine" additivity="false">
<level value="ERROR" />
<appender-ref ref="RootConsoleAppender" />
</logger>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文