Revision history [back]

click to hide/show revision 1
initial version

asked 2014-02-21 10:53:23 +0800

chillworld gravatar image chillworld flag of Belgium

https://github.com/chillw...

custom WrongValueException in logging

Hi all,

Now I have made some constraint with java code. Everything works great. There is just one thing that bothers me.

We throw a new WrongValueException(Component comp, String message);

Now in mine logging I can see this and it comes from :

org.zkoss.bind.impl.ParamCall:117

The method of that class :

public void call(Object base, Method method) {
Class<?>[] paramTypes = method.getParameterTypes();
    java.lang.annotation.Annotation[][] parmAnnos = method.getParameterAnnotations();
    Object[] params = new Object[paramTypes.length];
    try {
        for (int i = 0; i < paramTypes.length; i++) {
            params[i] = resolveParameter(parmAnnos[i],paramTypes[i]);
        }
        method.invoke(base, params);
    } catch(InvocationTargetException invokEx){ 
        //Ian YT Tsai (2012.06.20), while InvocationTargetException,
        //using original exception is much meaningful.
        Throwable c = invokEx.getCause();
        if(c == null) c = invokEx;
        _log.error(c);  // line 117.
        throw UiException.Aide.wrap(c);
    } catch (Exception e) {
        _log.error(e);
        throw UiException.Aide.wrap(e);
    }
}

Now this is for me NOT an error to be logged(user stupidity I don't log), and I don't want a complete stacktrace ruining mine log.

How can I fix this that mine log stays clean?

Greetz chill.

unwanted logging of custom WrongValueException in loggingWrongValueException

Hi all,

Now I have made some constraint with java code. Everything works great. There is just one thing that bothers me.

We throw a new WrongValueException(Component comp, String message);

Now in mine logging I can see this and it comes from :

org.zkoss.bind.impl.ParamCall:117

The method of that class :

public void call(Object base, Method method) {
Class<?>[] paramTypes = method.getParameterTypes();
    java.lang.annotation.Annotation[][] parmAnnos = method.getParameterAnnotations();
    Object[] params = new Object[paramTypes.length];
    try {
        for (int i = 0; i < paramTypes.length; i++) {
            params[i] = resolveParameter(parmAnnos[i],paramTypes[i]);
        }
        method.invoke(base, params);
    } catch(InvocationTargetException invokEx){ 
        //Ian YT Tsai (2012.06.20), while InvocationTargetException,
        //using original exception is much meaningful.
        Throwable c = invokEx.getCause();
        if(c == null) c = invokEx;
        _log.error(c);  // line 117.
        throw UiException.Aide.wrap(c);
    } catch (Exception e) {
        _log.error(e);
        throw UiException.Aide.wrap(e);
    }
}

Now this is for me NOT an error to be logged(user stupidity I don't log), and I don't want a complete stacktrace ruining mine log.

How can I fix this that mine log stays clean?

Greetz chill.

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More