[logback-dev] [Bug 100] Serialization of objectArray in LoggingEvent does not always work

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Sun Oct 28 14:39:47 CET 2007


http://bugzilla.qos.ch/show_bug.cgi?id=100





------- Comment #3 from joern at huxhorn.de  2007-10-28 14:39 -------
Workaround in SocketAppender:

protected void postProcess(LoggingEvent event)
{
    if (includeCallerData)
    {
      event.getCallerData();
    }
    // HACK: http://bugzilla.qos.ch/show_bug.cgi?id=100
    try
    {
        Field field=LoggingEvent.class.getDeclaredField("argumentArray");
        field.setAccessible(true);
        Object aa=field.get(event);
        if(aa instanceof Object[])
        {
            Object[] argumentArray=(Object[]) aa;

            for(int i=0;i<argumentArray.length;i++)
            {
                Object current=argumentArray[i];
                if(current!=null && !(current instanceof String))
                {
                    argumentArray[i]=""+current;
                }
            }
        }
    }
    catch (NoSuchFieldException e)
    {
        e.printStackTrace();
    }
    catch (IllegalAccessException e)
    {
        e.printStackTrace();
    }
}


-- 
Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the logback-dev mailing list