You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by "Chris Riccomini (JIRA)" <ji...@apache.org> on 2014/08/01 17:14:38 UTC

[jira] [Commented] (SAMZA-361) Remove Grizzled SLF4J

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

Chris Riccomini commented on SAMZA-361:
---------------------------------------

When we commit code to update SLF4J's MDC (SAMZA-310), we should make sure our logging code makes it easy to set the MDC's taskName variable so we're not constantly having to do this:

{code}
MDC.put(MDC_TASK_NAME, taskName)
// TaskInstance logic
info("some task log line")
// Switch back to container logic
MDC.put(MDC_TASK_NAME, emptyTaskName)
info("some container log line")
{code}

One idea would be something like this:

{code}
class TaskInstance(taskName: String, ...) implements Logging(taskName) {
  // ...
}
{code}

Then in Logging, something like:

{code}
def info() {
  if (!taskName.empty) {
  MDC.put(MDC_TASK_NAME, taskName)
  }
  info("some task log line")
  if (!taskName.empty) {
    MDC.put(MDC_TASK_NAME, emptyTaskName)
  }
}
{code}

This would allow us to continue to call info() in TaskInstance, and have the Logging class handle the MDC toggling for us.

Also, I think we should make our logging class API compatible with the current Grizzled Logging API. At least as close as possible (the proposed constructor change would be incompatible, for instance).

> Remove Grizzled SLF4J
> ---------------------
>
>                 Key: SAMZA-361
>                 URL: https://issues.apache.org/jira/browse/SAMZA-361
>             Project: Samza
>          Issue Type: Bug
>          Components: container
>    Affects Versions: 0.8.0
>            Reporter: Chris Riccomini
>             Fix For: 0.8.0
>
>
> The cons of Grizzled SLF4J outweigh the pros. We can [create a single class|https://github.com/apache/kafka/blob/0.8.1/core/src/main/scala/kafka/utils/Logging.scala] that does what we need for logging. Eliminating the Grizzled dependency means that we'll have one less Scala binary to depend on. It will also give us more control over SLF4J APis that we might want to use (e.g. the [MDC|http://www.slf4j.org/api/org/slf4j/MDC.html], see SAMZA-310).



--
This message was sent by Atlassian JIRA
(v6.2#6252)