title: Logback MDC put() mutable object
body: <p>I'm working with Vaadin framework, and it has poor support for intercepting events and I can't know when a session or a UI gets activated, so I can't put their ids in MDC.</p>
  
  <p>Normally I would:</p>
  
  <pre><code>public void onSessionBegin(){
      MDC.put("session", VaadinSession.getCurrent().toString()); //&lt;-- String is immutable
  }
  public void onSessionEnd(){
      MDC.remove("session");
  }
  </code></pre>
  
  <p>But I don't have such events, so I'd like to :</p>
  
  <pre><code>// in the servlet init or wherever
  MDC.put("session", new Object(){
          public String toString() {
              VaadinSession.getCurrent().toString()
          };
      }); //&lt;-- This is mutable and will be evaluated each time
  </code></pre>
  
  <p>This way, no matter how many time will change the session, in the log I'll get the current one.</p>
  
  <p>Is this possible? How can I replace the logback MDC implementation with a custom one? Should I edit the sources of slf4j and logback?</p>