Filtering out "value provider" console log messages - is there a better way?
By adding this at the start of my jazz java client code
static { System.setProperty("org.apache.commons.logging.Log", "com.greenelk.WorkitemMessageFilterLogger"); }this Class will VERY CRUDELY catch all messages and ignore the irritating ones that spew out in my console
package com.greenelk;I know it's an awful hack, but the messages drive me nuts. My question is : Is there a cleaner way of doing this?import org.apache.commons.logging.impl.Jdk14Logger;
public class WorkitemMessageFilterLogger extends Jdk14Logger {
private static final long serialVersionUID = 1L; private static final String filterName = "com.ibm.team.workitem.common"; private static final String[] filterMessagePrefixes = { "Value provider com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider for ", "Default value provider not found: com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider" }; private boolean filter = false; public WorkitemMessageFilterLogger(String name) { super(name); if (name.compareTo(filterName) == 0) { filter = true; } } public void error(Object message) { if (passthrough(message)) { super.error(message); } } public void error(Object message, Throwable x) { if (passthrough(message)) { super.error(message, x); } } private boolean passthrough(Object message) { if (filter && message != null && message instanceof String) { String msg = (String) message; for (String prefix : filterMessagePrefixes) { if (msg.startsWith(prefix)) { return false; } } } return true; }
}