title: How to use request param as log identifier in logback
body: <p>In my controller I get an <code>id</code> as request param. Is there a way to use this <code>id</code> to identify all the log entries of this particular request?</p>
  
  <pre><code>@ResponseBody
  @RequestMapping(value="/anyRequest", method = RequestMethod.GET)
  public String doAnything(@RequestParam(value="Id", required = true) long id) {
      logger.info(id);
      return "";
  }
  </code></pre>
  
  <p>Means anywhere of this entry should be the <code>id</code> value:</p>
  
  <pre><code>2017-02-28 08:30:41.035 INFO 23050 --- [http-bio-1084-exec-20] AnyServiceImpl ...
  </code></pre>
  
  <p>Im using logback and have this configuration:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
  
      &lt;springProfile name="dev"&gt;
         &lt;property name="FILE_PATH" value="C:\\DATA\\temp" /&gt;
      &lt;/springProfile&gt;
  
      &lt;appender name="FILE-AUDIT"
          class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;file&gt;${FILE_PATH}/service.log&lt;/file&gt;
          &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
              &lt;Pattern&gt;
                  %d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n
              &lt;/Pattern&gt;
          &lt;/encoder&gt;
  
          &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
              &lt;!-- rollover daily --&gt;
              &lt;fileNamePattern&gt;service.%d{yyyy-MM-dd}.%i.log
              &lt;/fileNamePattern&gt;
              &lt;timeBasedFileNamingAndTriggeringPolicy
                  class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"&gt;
                  &lt;maxFileSize&gt;25MB&lt;/maxFileSize&gt;
              &lt;/timeBasedFileNamingAndTriggeringPolicy&gt;
              &lt;maxHistory&gt;90&lt;/maxHistory&gt;
          &lt;/rollingPolicy&gt;
      &lt;/appender&gt;
  
      &lt;appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender"&gt;
          &lt;encoder&gt;
              &lt;charset&gt;UTF-8&lt;/charset&gt;
              &lt;Pattern&gt;%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n&lt;/Pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;logger name="Service" level="info"
          additivity="false"&gt;
          &lt;appender-ref ref="FILE-AUDIT" /&gt;
          &lt;appender-ref ref="consoleAppender" /&gt;
      &lt;/logger&gt;
  
      &lt;root level="info"&gt;
          &lt;appender-ref ref="FILE-AUDIT" /&gt;
          &lt;appender-ref ref="consoleAppender" /&gt;
      &lt;/root&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>And I use the logger in this way:</p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  private final Logger logger = LoggerFactory.getLogger(this.getClass());
  </code></pre>
  
  <p>Is there any Spring out of the box magic?</p>