Home arrow Support arrow Gurock Software Forum arrow General Discussion arrow Java logMessage and dynamic number of params

Subscribe to forum RSS Forum

Java logMessage and dynamic number of params

New Topic Post Reply

Page: 1

Author Post
Member
Registered: Dec 2007
Posts: 35
Location: Poland
Hello,

Is it possible to define String argument in Session.logMessage( String format, Object [] arg1), so that it would display all passed elements in arg1?

I'd like to use logMessage in spring Interceptor to log method arguments, so number of elements will differ for different methods.

best regards
Piotr Rezmer
Administrator
Registered: Sep 2007
Posts: 132
I think this is not possible. The format overloads of logMessage et. al. use the MessageFormat.format API to format the given format string and array. I haven't found anything in the docs that would indicate such a behavior. However, you could create a custom Session method for this scenario. Such a method (let's call it logArguments) could take a string (the title) and an array of Object. It could then concat the array and the title to a single string with the help of a StringBuffer/StringBuilder and the Objects' toString methods and then log this string with a standard logMessage call.

New Topic Post Reply

Page: 1