java.util.logging.Filter does not work when set in config-Class -
i trying set java.util.logging.filter
discard logs pollute standard.out.
i'am starting jvm -djava.util.logging.config.file=/path/to/my/logging.properties
, in properties file config = my.package.owbdelegatehanderlogdiscarder
set.
when debug can see logger retrieved , filter set. isloggable
method never called.
any ideas?
package my.package; import java.util.logging.filter; import java.util.logging.logrecord; import java.util.logging.logger; public class owbdelegatehanderlogdiscarder { /* * see org.apache.webbeans.config.owblogconst.error_0012 */ private static final string owb_log_const_error_0012 = "error_0012"; private static final string logger_name = "org.apache.webbeans.decorator.delegatehandler"; public owbdelegatehanderlogdiscarder() { logger delegatehandlerlogger = logger.getlogger(delegatehandler.class.getname()); if (delegatehandlerlogger != null) { delegatehandlerlogger.setfilter(new filter() { @override public boolean isloggable(logrecord record) { if (!logger_name.equals(record.getloggername())) { return true; } string message = record.getmessage(); return !(message != null && message.startswith(owb_log_const_error_0012)); } }); } }
update
i'm using cdi in application , found out works fine until call webbeanscontext currentinstance = webbeanscontext.currentinstance();
. seems bug , have file @ openwebbeans.
can somehow close question or should delete it?
Comments
Post a Comment