[logback-dev] [JIRA] Commented: (LBCLASSIC-201) Preferably don't call toString() on objects in arguments array
Rü (JIRA)
noreply-jira at qos.ch
Tue Apr 6 16:22:16 CEST 2010
[ http://jira.qos.ch/browse/LBCLASSIC-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11710#action_11710 ]
Rü commented on LBCLASSIC-201:
------------------------------
I think that common Java types like Long, Calendar, java.sql.Date, etc. should be considered safe by default.
The common way to specify which classes are safe would be to configure it in some file on the client. I think this should not be by class nor by package name but by jar, and include a version string.
But it would be much nicer for the client and server to do a hand-shake to automagically aggree on the list of safe jars: When the client starts, it asks the server for the list of jars that it knows about. It then transmits all instances of classes from matching jars in serialized form. The list would preferably not contain the file name of a jar but data from it's manifest. You can get a list of all available manifests by calling classLoader.getResources("META-INF/MANIFEST.MF"). If it contains a Bundle-SymbolicName and Bundle-Version, use that; if it contains Implementation-Title and Implementation-Version, use that. If it contains none of these, log a warning and use the jar name.
> 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
More information about the logback-dev
mailing list