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

Íñigo Goiri commented on HDFS-13435:
------------------------------------

BTW, a clarification on having the exception at the end of error() without a 
marker.
The following code:
{code}
LOG.error("Test exception param={}", "testparam", new IOException("Test 
message"));
{code}
Produces this:
{code}
2018-04-12 09:24:03,954 ERROR [main] ExampleClass: Test exception 
param=testparam
java.io.IOException: Test message
        at 
org.apache.hadoop.loganalyzer.mapreduce.app.AppLogAnalyzerMapReduce.run(AppLogAnalyzerMapReduce.java:56)
        at org.apache.hadoop.loganalyzer.LogAnalyzer.main(LogAnalyzer.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
{code}

So this case pointed out by [~ywskycn] is correct:
{code}
LOG.error("Unexpected exception {} proxying {} to {}",
    e.getClass(), m.getName(), ns, e);
{code}
The quesiton is whether we want the full stack trace or not.

 

> RBF: Fix wrong error loggings
> -----------------------------
>
>                 Key: HDFS-13435
>                 URL: https://issues.apache.org/jira/browse/HDFS-13435
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>    Affects Versions: 3.0.1
>            Reporter: Yiqun Lin
>            Assignee: Yiqun Lin
>            Priority: Major
>         Attachments: HDFS-13435.001.patch
>
>
> There are many places that using {{Logger.error(String format, Object... 
> arguments)}} incorrectly.
>  A example:
> {code:java}
> LOG.error("Cannot remove {}", path, e);
> {code}
> The exception passed here is no meaning and won't be printed. Actually it 
> should be update to
> {code:java}
> LOG.error("Cannot remove {}: {}.", path, e.getMessage());
> {code}
> or 
> {code:java}
> LOG.error("Cannot remove " +  path, e));
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to