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

ASF subversion and git services commented on LOG4J2-3021:
---------------------------------------------------------

Commit 3165330ab71f5313a2bc1d83eb07546e9499ca42 in logging-log4j2's branch 
refs/heads/release-2.x from Volkan Yazıcı
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=3165330 ]

LOG4J2-3020 LOG4J2-3021 Improve Logger javadoc for throwing() and catching(). 
(#466)



> Logger.throwing(Throwable) does not document level it is logging at
> -------------------------------------------------------------------
>
>                 Key: LOG4J2-3021
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3021
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.14.0
>            Reporter: Marcono1234
>            Assignee: Volkan Yazici
>            Priority: Major
>
> The 
> [documentation|https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/Logger.html#throwing-T-]
>  of the method {{Logger.throwing(Throwable)}} is not mentioning at which 
> level it is logging at.
> It appears {{AbstractLogger}} is logging at level {{ERROR}}, but without it 
> being explicitly mentioned, I think expecting it to be logged at {{DEBUG}} 
> might also be a reasonable expectation.
> In fact LOG4J2-1003 implements it to log at debug level, and based on what 
> the {{throwing}} documentation suggests as use case, {{AbstractLogger}} 
> should be logging at debug level:
> {quote}
> {code}
> throw logger.throwing(myException);
> {code}
> {quote}
> Having an exception which is thrown additionally be logged as error will 
> result in duplicate error messages in the log file (unless the exception 
> handling is broken), one from the {{throwing}} call and a second one from the 
> method handling that exception.
> Therefore {{throwing}} should in my opinion only log at {{DEBUG}} level, 
> similar to how {{java.util.logging}} is doing it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to