You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Philippe Gassmann (JIRA)" <ji...@apache.org> on 2007/03/07 17:44:24 UTC

[jira] Created: (HADOOP-1078) Improve logging

Improve logging
---------------

                 Key: HADOOP-1078
                 URL: https://issues.apache.org/jira/browse/HADOOP-1078
             Project: Hadoop
          Issue Type: Improvement
            Reporter: Philippe Gassmann


Loggers in hadoop are created using LogFactory.getLog("some package styled things"); 

This is very confusing since the string specified in getLog() sometime is the class name sometime not. (eg : the class org.apache.hadoop.mapred.Task contains a logger created by LogFactory.getLog("org.apache.hadoop.mapred.TaskRunner"); which is very confusing)

I think that logger should be always created using  LogFactory.getLog(MyClass.class); and that if a class needs a logger, then a specific logger must be crated for that class (ie: loggers are private).





-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-1078) Improve logging

Posted by "Philippe Gassmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-1078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481087 ] 

Philippe Gassmann commented on HADOOP-1078:
-------------------------------------------

The current configuration of log4j is prints stacktraces if you do "LOG.error("foo", e)" 
eg: I've just added one line in NameNode.open() method : LOG.error("TEST", new Exception("this is a test exception");

The result in the logs : 

2007-03-15 10:04:27,983 ERROR org.apache.hadoop.dfs.NameNode: TEST
java.lang.Exception: this is a test exception
        at org.apache.hadoop.dfs.NameNode.open(NameNode.java:209)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:337)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:538)

So it seems to be working :)

> Improve logging
> ---------------
>
>                 Key: HADOOP-1078
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1078
>             Project: Hadoop
>          Issue Type: Improvement
>            Reporter: Philippe Gassmann
>
> Loggers in hadoop are created using LogFactory.getLog("some package styled things"); 
> This is very confusing since the string specified in getLog() sometime is the class name sometime not. (eg : the class org.apache.hadoop.mapred.Task contains a logger created by LogFactory.getLog("org.apache.hadoop.mapred.TaskRunner"); which is very confusing)
> I think that logger should be always created using  LogFactory.getLog(MyClass.class); and that if a class needs a logger, then a specific logger must be crated for that class (ie: loggers are private).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-1078) Improve logging

Posted by "Philippe Gassmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-1078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480018 ] 

Philippe Gassmann commented on HADOOP-1078:
-------------------------------------------

Also the use of StringUtils.stringifyException should be avoided in log messages eg : 
This code is *wrong* : LOG.error("Expire Launching Task Thread got exception: " + StringUtils.stringifyException(e)); 
This code is *good* : LOG.error("Expire Launching Task Thread got exception: ", e);

> Improve logging
> ---------------
>
>                 Key: HADOOP-1078
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1078
>             Project: Hadoop
>          Issue Type: Improvement
>            Reporter: Philippe Gassmann
>
> Loggers in hadoop are created using LogFactory.getLog("some package styled things"); 
> This is very confusing since the string specified in getLog() sometime is the class name sometime not. (eg : the class org.apache.hadoop.mapred.Task contains a logger created by LogFactory.getLog("org.apache.hadoop.mapred.TaskRunner"); which is very confusing)
> I think that logger should be always created using  LogFactory.getLog(MyClass.class); and that if a class needs a logger, then a specific logger must be crated for that class (ie: loggers are private).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-1078) Improve logging

Posted by "Owen O'Malley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-1078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481004 ] 

Owen O'Malley commented on HADOOP-1078:
---------------------------------------

How do you configure log4j to print the exception and call stack? With our current configuration, if you log like LOG.error("foo", e) you get no information from the exception, which makes it pretty useless for debugging. *smile*

> Improve logging
> ---------------
>
>                 Key: HADOOP-1078
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1078
>             Project: Hadoop
>          Issue Type: Improvement
>            Reporter: Philippe Gassmann
>
> Loggers in hadoop are created using LogFactory.getLog("some package styled things"); 
> This is very confusing since the string specified in getLog() sometime is the class name sometime not. (eg : the class org.apache.hadoop.mapred.Task contains a logger created by LogFactory.getLog("org.apache.hadoop.mapred.TaskRunner"); which is very confusing)
> I think that logger should be always created using  LogFactory.getLog(MyClass.class); and that if a class needs a logger, then a specific logger must be crated for that class (ie: loggers are private).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.