[ 
https://issues.apache.org/jira/browse/LOG4J2-1676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15670989#comment-15670989
 ] 

Gary Gregory commented on LOG4J2-1676:
--------------------------------------

Hi,

Ideally, I would like to see one patch file with unit test changes that I can 
apply and see tests fail.

Then another patch file with the main changes that fix the tests.

Since your main changes are in the API module's AbstractLogger class, you could 
try to write a test in that module's package. 

IIRC, in the API module the only subclass of AbstractLogger is SimpleLogger 
which does not do much, so that might not help. We also have a 
org.apache.logging.log4j.TestLogger class but I did not dig to see how it is 
used. That's worth a look.

In addition, testing from the Core module would also be a good thing. There are 
lots test in the Core modules to get inspiration from. Maybe start with 
org.apache.logging.log4j.core.LoggerTest

The bottom line is that we want a test that will guard against a future 
regression.

I hope this helps! :-)

Gary



> Use Message.getThrowable() in log(Message) methods
> --------------------------------------------------
>
>                 Key: LOG4J2-1676
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1676
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.5, 2.6, 2.7
>            Reporter: Joern Huxhorn
>         Attachments: 0001-Using-Throwable-of-Message-if-available.patch, 
> 0002-Using-Throwable-of-Message-if-not-explicitly-given.patch
>
>
> All {{log(Message)}} methods should use {{Message.getThrowable()}}, e.g.
> {code:java}
>     public void debug(final Message msg) {
>         logIfEnabled(FQCN, Level.DEBUG, null, msg, msg != null ? 
> msg.getThrowable() : null);
>     }
> {code}
> instead of the current
> {code:java}
>     public void debug(final Message msg) {
>         logIfEnabled(FQCN, Level.DEBUG, null, msg, null);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to