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

Jay Kreps commented on KAFKA-193:
---------------------------------

Hmm, have you tried this out? Not sure if that works. You are doing
  def throwableString(e: => Throwable) = e.getStackTrace.toString

But getStackTrace gives a java array primitive, so that doesn't print a stack 
trace:

jkreps-mn:~ jkreps$ scala
scala> val e = new RuntimeException("Hello")
e: java.lang.RuntimeException = java.lang.RuntimeException: Hello

scala> e.getStackTrace.toString
res8: java.lang.String = [Ljava.lang.StackTraceElement;@4439bc82

What if instead we stick with log4j and do the following variants (for 
info/debug/trace/error/fatal):
def info(m: =>String) = if(logger.isInfoEnabled) logger.info(m)
def info(m: =>String, e: Throwable) = if(logger.isInfoEnabled) logger.info(m, e)
def info(e: Throwable) = if(logger.isInfoEnabled) logger.info("", e)

I think this does what we want with respect to exceptions.
                
> use by name parameter helper for logging and trait to include lazy logging 
> and refactor code to use the new LogHelper
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-193
>                 URL: https://issues.apache.org/jira/browse/KAFKA-193
>             Project: Kafka
>          Issue Type: Improvement
>    Affects Versions: 0.7
>            Reporter: Joe Stein
>             Fix For: 0.8
>
>         Attachments: kafka-193-consistent-level-throwable.patch, 
> kafka-193.patch
>
>
> 1) New tait to include logging and helper methods so if 
> (log.isDebugEnabled()) is not required because it is in the helper and log 
> paramaters are passed by name so not executed to tidy up the code
> 2) refactor all occurrence of logging to use the log helper
> 3/4 (possibly to be handled in to tickets) the "lint" affect from this for 
> changes patched but not on trunk and new patches moving forward until this is 
> baked in

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to