[Bug 158] New: Placeholder resolution for logger method varargs

4 messages Options
Embed this post
Permalink
Bugzilla from bugzilla-daemon@pixie.qos.ch

[Bug 158] New: Placeholder resolution for logger method varargs

Reply Threaded More More options
Print post
Permalink
http://bugzilla.slf4j.org/show_bug.cgi?id=158

           Summary: Placeholder resolution for logger method varargs
           Product: SLF4J
           Version: 1.5.x
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Core API
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


Hi guys,
just wondering if this feature could possibly be implemented:

Suppose I have the following log statement:

logger.debug("Bla bla {}", stringArray);

with a String array parameter, which's size I don't know beforehand. Could we
get a special syntax, like [{}] that resolves all array parameters (possibly
with spaces), instead of {} which will just print out the first one?

Cheers!


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dev mailing list
[hidden email]
http://www.slf4j.org/mailman/listinfo/dev
Bugzilla from bugzilla-daemon@pixie.qos.ch

[Bug 158] Placeholder resolution for logger method varargs

Reply Threaded More More options
Print post
Permalink
http://bugzilla.slf4j.org/show_bug.cgi?id=158





--- Comment #1 from Ceki Gulcu <[hidden email]>  2009-10-29 12:32:03 ---
Hello Marci,

Try the following syntax:

  logger.debug("Bla bla {}", new Object[] {stringArray});


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dev mailing list
[hidden email]
http://www.slf4j.org/mailman/listinfo/dev
Bugzilla from bugzilla-daemon@pixie.qos.ch

[Bug 158] Placeholder resolution for logger method varargs

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bugzilla from bugzilla-daemon@pixie.qos.ch
http://bugzilla.slf4j.org/show_bug.cgi?id=158





--- Comment #2 from Marco Behler <[hidden email]>  2009-10-29 13:21:57 ---
(In reply to comment #1)
> Hello Marci,
>
> Try the following syntax:
>
>   logger.debug("Bla bla {}", new Object[] {stringArray});
>

Hi Ceki,
this works almost as expected. Just a bit about my use case: I have to write
some Java command line wrappers (like someCommand.sh -param1 value1 -param2
value2 -param3 value3) at the moment and would like to print out the complete
command that gets executed. Now with new Object[] {array} Slf4j will output
[someComand.exe, -param1, -value1, -param2], though I'd like to be able to just
cut & paste the entire command into my shell and run it, without having to
delete the commas.

To cut a long story short, your suggestion works, but it could be made a bit
more convenient - on the other hand I understand if it's too much hassle and
doesn't fit into the current api.

Anyway, thanks for slf4j!

:)


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dev mailing list
[hidden email]
http://www.slf4j.org/mailman/listinfo/dev
Bugzilla from bugzilla-daemon@pixie.qos.ch

[Bug 158] Placeholder resolution for logger method varargs

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bugzilla from bugzilla-daemon@pixie.qos.ch
http://bugzilla.slf4j.org/show_bug.cgi?id=158


Joern Huxhorn <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]




--- Comment #3 from Joern Huxhorn <[hidden email]>  2009-10-30 00:04:49 ---
A change like that would have side-effects on already existing logging messages
that would like to print the first parameter enclosed in []....


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dev mailing list
[hidden email]
http://www.slf4j.org/mailman/listinfo/dev