Add "filter" in the "logger" for the entire application

1

I would like to have Filter of java.util.logging.Logger to filter all generated log lines. In case, I'm using a Wildfly application server.

Currently, I can only filter a specific class, for example.

Logger logger = Logger.getLogger(Classe.class.getName());
logger.setFilter(new MeuFiltro());

That is, instead of filtering just one class, I would like to filter everything and this needs to be done programmatically, since making changes to the Wildfly XML will not be viable.

    
asked by anonymous 23.02.2018 / 12:58

1 answer

0

You need to get the root logger:

Logger rootLogger = LogManager.getLogManager().getLogger("");
    
23.02.2018 / 14:34