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
Subscribe to forum
Forum
Java logMessage and dynamic number of params
Page: 1
| Author | Post |
|---|---|
|
#1 Sun Jun 08, 2008 1:56 pm
|
|
|
Member
Registered: Dec 2007
Posts: 35
Location: Poland
|
|
|
#2 Sun Jun 08, 2008 3:45 pm
|
|
|
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.
|
Page: 1