Jodd Java - Can i hide WARN message on console?

742 views Asked by At

My Program not error is perfect work but I feel annoyed from warning message.

So, I want to hide it from program console. What should I do?

(i can't edit html source code)

[Thread-4] WARN jodd.lagarto.dom.LagartoDOMBuilderTagVisitor - Orphan closed tag ignored </meta> 
[Thread-3] WARN jodd.lagarto.dom.LagartoDOMBuilderTagVisitor - Unclosed tag closed: <p> 

Thanks for kindness.

2

There are 2 answers

0
Jaynova On

Oh Yea!

I can find solution with myself. (Thank a lot Elliott Frisch for guide :) )

i use Logback Library

import ch.qos.logback.classic.Logger;
import org.slf4j.LoggerFactory;

public class Main {

    final static Logger joddlogger = (Logger) LoggerFactory.getLogger("jodd");

    public static void main(String[] argv) {

        joddlogger.setLevel(ch.qos.logback.classic.Level.OFF);
        //do something...

    }
}
0
igr On

That is one correct answer, as @Jaynova and @Elliott Frisch said. Jodd uses Logback, so all you have to do is to mute the logging category in logback configuration, as explained in the other answer. You can do that from Java or from logback configuration file.

There is one more solution, added recently: LagartoDOMBuilder has a property parsingErrorLogLevel, which purpose is to set the log level of parsing errors (by default is set to WARN). Sometimes, its important to have these errors in the log (eg parsing your own code), and sometimes its just annoying (parsing live code, usually with lot of errors).

So while you can switch off the all logging for that package, you may also mute just the parsing errors by setting the level to DEBUG (assuming your global log level is higher).

So, in short, get the LagartoDOMBuilder instance before parsing and set this flag :)