<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br>On Feb 24, 2009, at 7:36 AM, Joern Huxhorn wrote:<br><br><blockquote type="cite">Ceki Gulcu wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Joern Huxhorn wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Therefore I'd suggest to define void setArgumentArray(String[])<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">instead of void setArgumentArray(Object[]) (see<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://jira.qos.ch/browse/LBCLASSIC-45">http://jira.qos.ch/browse/LBCLASSIC-45</a>&nbsp;)<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">As Ralf mentioned, under certain circumstances it may be useful to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">place objects types other than strings as parameters to logging<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">event. In my previous proposal for ILoggingEvent the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">getArgumentArray() method returned String[]. I think this should be<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">modified to Object[] because even if only strings are serialized, we<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">should probably not impact local usage of parameters. ILoggingEvent<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">then becomes:<br></blockquote></blockquote><blockquote type="cite">I knew that somebody posted to one of the lists that he's using the<br></blockquote><blockquote type="cite">Object[] feature in his code but I couldn't remember who it was. Sorry,<br></blockquote><blockquote type="cite">Ralph.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I can absolutely see Ralphs point but I'd consider it downright<br></blockquote><blockquote type="cite">dangerous to defer the evaluation to Strings, especially in case of<br></blockquote><blockquote type="cite">asynchronous appenders.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Take, for example, an object that is persisted using Hibernate. Calling<br></blockquote><blockquote type="cite">toString() at the wrong time could very well lead to a LazyInitException.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Or worse, what if an Object changes state (and string representation)<br></blockquote><blockquote type="cite">between the logging call and the evaluation of the message? The message<br></blockquote><blockquote type="cite">would essentially contain a lie. It would seem that the call to the<br></blockquote><blockquote type="cite">logging method was different than it was in reality.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Imagining to debug a problem like this is pure horror and would mean<br></blockquote><blockquote type="cite">"forget logging, use a debugger" all over again :(<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">And, last but not least, transforming to String[] immediately would also<br></blockquote><blockquote type="cite">mean that any synchronization/locks would still be the way they (most<br></blockquote><blockquote type="cite">likely;)) should be.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Concerning your use case, Ralph, aren't you using an XLogger instance<br></blockquote><blockquote type="cite">for that kind of magic? Couldn't you implement the "magic" part in the<br></blockquote><blockquote type="cite">XLogger.<br></blockquote><blockquote type="cite"><br></blockquote><br>Yes and no. The API would be a call like logger.logEvent(EventData data); &nbsp;EventData is really just a Map with a few extra methods. Under the hood the event data gets serialized to XML as the "message" but the EventData map is still passed as a parameter. Then when the Appender gets the LoggingEvent it can first check for the map being present. If it is it can just use it and the serialized XML just gets ignored. Otherwise we have to go through the expense of reconstructing the map from the message. If one of the out-of-the box Appenders is used then the map will be ignored and only the serialized map is recorded, but if someone wants to write a custom appender it will save quite a bit of overhead in not having to reconstruct the EventData map on every audit event.<br><br>Ralph<br></body></html>