title: symfony2 empty session id in service
body: <p>I use symfony 2.5, and I have next service for monolog.</p>
  
  <pre><code>&lt;?php
  
  namespace Megogo\CoreBundle;
  
  use Symfony\Component\HttpFoundation\Session\Session;
  
  class SessionRequestProcessor
  {
      /**
       * @var \Symfony\Component\HttpFoundation\Session\Session
       */
      protected $session;
  
      /**
       * @var
       */
      private $token;
  
      public function __construct( Session $session)
      {
          $this-&gt;session = $session;
      }
  
      public function processRecord(array $record)
      {
  
          if (null === $this-&gt;token) {
              try {
                  $this-&gt;token = $this-&gt;session-&gt;getId();
              } catch (\RuntimeException $e) {
                  $this-&gt;token = '????????';
              }
  
          }
          $record['extra']['token'] = $this-&gt;token;
  
          return $record;
      }
  } 
  </code></pre>
  
  <p>service.yml</p>
  
  <pre><code>services:
      monolog.formatter.session_request:
          class: Monolog\Formatter\LineFormatter
          arguments:
              - "[%%datetime%%] [%%extra.token%%] %%channel%%.%%level_name%%: %%message%%\n"
  
      monolog.processor.session_request:
          class: Megogo\CoreBundle\SessionRequestProcessor
          arguments:  ["@session"]
          tags:
              - { name: monolog.processor, method: processRecord }
  </code></pre>
  
  <p>I get example from official documentation. <a href="http://symfony.com/doc/current/cookbook/logging/monolog.html#adding-a-session-request-token" rel="nofollow">Adding a Session/Request Token</a></p>
  
  <p>I have problem, that <code>$this-&gt;session-&gt;getId()</code> return empty string. If I add  <code>$session-&gt;start();</code>  all works. I can get session id. But this is weird, because in other my services all works without this workaround. And when I make <code>app/console cache:clear</code> I have error <code>Failed to start the session: already started by PHP.</code> </p>