[ 
http://jira.qos.ch/browse/LBCLASSIC-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11711#action_11711
 ] 

Joern Huxhorn commented on LBCLASSIC-201:
-----------------------------------------

Yes, standard Java classes wouldn't pose a problem.

However, I guess Donald is interested in keeping a more complex, custom class - 
otherwise it wouldn't be a problem to simply parse it from the string. What 
exactly are you trying to do?

Making the supported types configurable would add significant complexity to 
both appender and receiver and would likely slow it down, too.

One possibility would be to make it configurable if this conversion should be 
done or not. One should be aware, though, that If the conversion is disabled 
(i.e. Serialized non-String objects are transmitted if they implement 
Serializable) then a failing deserialization on the client would render the 
whole following stream of events unusable/unreadable. This could get 
problematic in case of third-party libraries since no-one knows what they might 
put in as parameters.
I regularly put all kinds of objects in there so this would essentially mean 
that the receiver would need *all* dependencies of the actual app (and also 
*exactly* the same versions) - which sounds to me like a very big 
administration nightmare.

This might be another case where the suggested message extension of SLF4J might 
come in handy, assuming that some additional message types would already be 
defined in SLF4J API.

> Preferably don't call toString() on objects in arguments array
> --------------------------------------------------------------
>
>                 Key: LBCLASSIC-201
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-201
>             Project: logback-classic
>          Issue Type: Improvement
>          Components: appender
>    Affects Versions: 0.9.19
>         Environment: Software platform
>            Reporter: Donald Graham
>            Assignee: Ceki Gulcu
>
> I'm attempting to use a SocketAppender to send log events over the network to 
> a custom appender hosted by SimpleSocketServer.  My custom appender needs to 
> work with my arguments as objects, rather than strings.  I noticed that the 
> string representations of my arguments were being passed across the network, 
> and traced through to the code shown below (from 
> ch.qos.logback.classic.spi.LoggingEventVO).  Would you consider sending the 
> object's serialized form instead (assuming the object is serializable)? 
>   private void writeObject(ObjectOutputStream out) throws IOException {
>     out.defaultWriteObject();
>     out.writeInt(level.levelInt);
>     if (argumentArray != null) {
>       int len = argumentArray.length;
>       out.writeInt(len);
>       for (int i = 0; i < argumentArray.length; i++) {
>         if (argumentArray[i] != null) {
>           out.writeObject(argumentArray[i].toString());
>         } else {
>           out.writeObject(NULL_ARGUMENT_ARRAY_ELEMENT);
>         }
>       }
>     } else {
>       out.writeInt(NULL_ARGUMENT_ARRAY);
>     }
>   }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to