git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] activemq pull request #303: Use varargs for log parameters instead of `new O...


GitHub user FSchumacher opened a pull request:

    https://github.com/apache/activemq/pull/303

    Use varargs for log parameters instead of `new Object[]`

    Some log statements where called with a combination of `new Object[] {...}` and
    an exception. That lead to a misinterpretation of those parameters. The first
    object array is considered to be the first argument and the exception the second
    parameter of the format string.
    It should have been interpreted as the members of the object array as the parameters
    for the format string and the exception as the exception itself.
    
    So for example:
    
    ```
      LOG.info("User {} has done {}", new Object[] {"A", "something"}, e);
    ```
    
    would log something like:
    
    ```
      User [A, something] has done java.lang.RuntimeException: OOps
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/FSchumacher/activemq wrong-log-arguments

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq/pull/303.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #303
    
----
commit 7d8c2b5556a9621ad60b6537c53c4162e6c17858
Author: Felix Schumacher <felix.schumacher@...>
Date:   2018-10-06T09:03:26Z

    Use varargs for log parameters instead of `new Object[]`
    
    Some log statements where called with a combination of `new Object[] {...}` and
    an exception. That lead to a misinterpretation of those parameters. The first
    object array is considered to be the first argument and the exception the second
    parameter of the format string.
    It should have been interpreted as the members of the object array as the parameters
    for the format string and the exception as the exception itself.
    
    So for example:
    
      LOG.info("User {} has done {}", new Object[] {"A", "something"}, e);
    
    would log something like:
    
      User [A, something] has done java.lang.RuntimeException: OOps

----


---