Maven 2 & 3
  1. Maven 2 & 3
  2. MNG-2727

Fix Logging in threadsafe components

    Details

    • Type: Task Task
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.x / Backlog
    • Component/s: Embedding
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Activity

      Hide
      Ceki Gulcu added a comment -

      FYI, SLF4J supports MDC but not NDC. There are counter arguments for making SLF4J an optional dependency: see http://slf4j.org/faq.html#optional_dependency

      However, whether you choose to depend on SLF4J or go through your own facade, I am fairly certain that neither approach will be future proof.

      Show
      Ceki Gulcu added a comment - FYI, SLF4J supports MDC but not NDC. There are counter arguments for making SLF4J an optional dependency: see http://slf4j.org/faq.html#optional_dependency However, whether you choose to depend on SLF4J or go through your own facade, I am fairly certain that neither approach will be future proof.
      Hide
      Kristian Rosenvold added a comment - - edited

      I am a bit unsure of exactly which application use-case is being addressed in this issue;

      For the current concurrency effort (MNG-3004) my current favourite strategy is replacing the LoggerManager with a ConcurrentLoggerManager that
      provides a MavenProject-aware proxy for the existing logger subsystem. Such a proxy would typically be able to collect all logger output for
      the project to a single outputstream, no matter how this intertwines with other builds.

      A rough draft of this logic can be seen in LifecycleThreadedBuilder line 164 & 167, where the MavenProject is associated with the current thread (Code is commented out because the current implementation is not good enough). This association changes logger output, and the setThisModuleComplete releases the output.

      I fully sense that there may be some other use cases, possibly related to embedding. But it seems like a solution that captures the "logical stream" that constitutes the output from a single build should be expandable to these different cases.

      Show
      Kristian Rosenvold added a comment - - edited I am a bit unsure of exactly which application use-case is being addressed in this issue; For the current concurrency effort ( MNG-3004 ) my current favourite strategy is replacing the LoggerManager with a ConcurrentLoggerManager that provides a MavenProject-aware proxy for the existing logger subsystem. Such a proxy would typically be able to collect all logger output for the project to a single outputstream, no matter how this intertwines with other builds. A rough draft of this logic can be seen in LifecycleThreadedBuilder line 164 & 167, where the MavenProject is associated with the current thread (Code is commented out because the current implementation is not good enough). This association changes logger output, and the setThisModuleComplete releases the output. I fully sense that there may be some other use cases, possibly related to embedding. But it seems like a solution that captures the "logical stream" that constitutes the output from a single build should be expandable to these different cases.
      Hide
      Jason van Zyl added a comment -

      Stuart is taking care of this as part of moving over to Guice. We just need to inject a threadsafe logger. There's no point in doing this in Plexus and in Guice.

      Show
      Jason van Zyl added a comment - Stuart is taking care of this as part of moving over to Guice. We just need to inject a threadsafe logger. There's no point in doing this in Plexus and in Guice.
      Hide
      Brett Porter added a comment -

      since the switch to Guice happened, is there anything still left to do here, or was it taken care of as suggested in the last comment?

      Show
      Brett Porter added a comment - since the switch to Guice happened, is there anything still left to do here, or was it taken care of as suggested in the last comment?
      Hide
      Kristian Rosenvold added a comment -

      I'm not really sure we need to do anything more about this issue, the 3.x logging seems to work fairly well in parallel.

      Show
      Kristian Rosenvold added a comment - I'm not really sure we need to do anything more about this issue, the 3.x logging seems to work fairly well in parallel.

        People

        • Assignee:
          Jason van Zyl
          Reporter:
          Jason van Zyl
        • Votes:
          4 Vote for this issue
          Watchers:
          4 Start watching this issue

          Dates

          • Created:
            Updated: