title: Displaying Logging Information in View Model
body: <p>After I log something in my program, I stored the Logging information in a public field called LogItems in the class CustomLogger.</p>
  
  <p>EDIT: My CustomLogger class now implements IMyLogger</p>
  
  <pre><code>public class CustomLogger : IMyLogger
  {
  
  // LogItems are stored in this field. Assume that it is not Null.
  public ObservableCollection&lt;LogItem&gt; LogItems = new ObservableCollection&lt;LogItem&gt;
  
  public CustomLogger()
  {
  }
  
  // Other methods that populate the LogItems field
  
  }
  </code></pre>
  
  <p>IMyLogger is the following:</p>
  
  <pre><code>public interface IMyLogger : ILoggerFacade
  {
      ObservableCollection&lt;LogItem&gt; LogItems { get; set; }
  }
  </code></pre>
  
  <p>EDIT: Can anyone tell me how to retrieve the LogItems object from the CustomLogger class? I would need the LogItems in order to display it in my viewModel. My ViewModel class is the following:</p>
  
  <pre><code>[Export]
  [PartCreationPolicy(System.ComponentModel.Composition.CreationPolicy.Shared)]
  public class LoggerViewModel : ViewModelBase
  {
      public ObservableCollection&lt;LogItem&gt; LogItems { get; set; }
      protected static readonly ILog log = LogManager.GetLogger(typeof(LoggerViewModel));
  
      [ImportingConstructor]
      public LoggerViewModel(CustomLogger cLogger)
      {
      // Can anyone tell me why I cannot call LogItems from cLogger here? An activation error is being thrown here.
          LogItems = cLogger.LogItems;
      }
  }
  </code></pre>
  
  <p>After running the code, I get an activation error when trying to get instance of type LoggerView, key "".</p>
  
  <p>If I change the LoggerViewModel constructor to </p>
  
  <pre><code>    public LoggerViewModel()
      {       
      }
  </code></pre>
  
  <p>No error is thrown but nothing is displayed in my view model.</p>
  
  <p>How would I be able to display logging information in my view model?</p>