plutext / docx4j-ImportXHTML

Converts XHTML to OpenXML WordML (docx) using docx4j
135 stars 124 forks source link

Log Skipping outline-color (null) #96

Open feiyuone opened 1 year ago

feiyuone commented 1 year ago

hello, when I use docx4j-ImportXHTML convert a html file to docx file,I got a lot of logs like these:

08:58:00.308 [http-nio-8080-exec-3] WARN o.d.c.in.xhtml.XHTMLImporterImpl 784 - Skipping clip .. (null value) 08:58:00.309 [http-nio-8080-exec-3] WARN o.d.c.in.xhtml.XHTMLImporterImpl 784 - Skipping outline-color .. (null value) 08:58:00.309 [http-nio-8080-exec-3] WARN o.d.c.in.xhtml.XHTMLImporterImpl 784 - Skipping outline-style .. (null value) 08:58:00.309 [http-nio-8080-exec-3] WARN o.d.c.in.xhtml.XHTMLImporterImpl 784 - Skipping outline-width .. (null value) 08:58:00.309 [http-nio-8080-exec-3] WARN o.d.c.in.xhtml.XHTMLImporterImpl 784 - Skipping unicode-bidi .. (null value)

the java version is 1.8.0_371,docx4j-ImportXHTML is 8.3.8. how can i fixed it or how can i block these logs? thanks for advanced!

mmatias27 commented 7 months ago

Hello. I had the same problem. I solved it by filtering the log lines, creating a filter in the logback.xml file

<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">      
            <evaluator> <!-- defaults to type ch.qos.logback.classic.boolex.JaninoEventEvaluator -->
              <expression>
                if( logger.contains("XHTMLImporterImpl") &amp;&amp; <!-- & encoded as &amp; -->
                    level == WARN &amp;&amp;
                    message.contains(".. (null value)")) {
                        return true;
                }

                return false;
              </expression>
            </evaluator>
            <OnMismatch>NEUTRAL</OnMismatch>
            <OnMatch>DENY</OnMatch>
        </filter>       
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%thread]  %-60logger{40} %-5line: %msg%n
            </pattern>
        </encoder>
    </appender>

    <logger name="org.docx4j" level="WARN" />

    <root level="INFO">
        <appender-ref ref="STDOUT" />
    </root>

</configuration>