title: Setting a 'category' in the .net enterprise library logging (to event log)
body: <p>I am writing some logs to the event log using the Microsoft enterprise library </p>
  
  <p>Its writes logs away fine but doesnt seem to set the category in the event log. The category appears okay in the message body of the log (if I choose to set that) but the <em>event viewer</em> doesnt pick up the category.</p>
  
  <p>What am i missing?</p>
  
  <hr>
  
  <p>c# source</p>
  
  <pre><code>LogEntry log = new LogEntry();
  log.Message = "Test";
  log.Categories.Add("Event");
  Logger.Write(log);
  </code></pre>
  
  <p>web config</p>
  
  <pre><code>&lt;loggingConfiguration name="Logging Application Block" tracingEnabled="true"
  defaultCategory="General" logWarningsWhenNoCategoriesMatch="true"&gt;
  &lt;listeners&gt;
    &lt;add source="TestLogSource" formatter="Text Formatter" log="TestLog"
      machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
      traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
      name="Formatted EventLog TraceListener" /&gt;
  &lt;/listeners&gt;
  &lt;formatters&gt;
    &lt;add template="Timestamp: {timestamp}&amp;#xD;&amp;#xA;Message: {message}&amp;#xD;&amp;#xA;Category: {category}&amp;#xD;&amp;#xA;Severity: {severity}"
      type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
      name="Text Formatter" /&gt;
  &lt;/formatters&gt;
  &lt;categorySources&gt;
    &lt;add switchValue="All" name="Events"&gt;
      &lt;listeners&gt;
        &lt;add name="Formatted EventLog TraceListener" /&gt;
      &lt;/listeners&gt;
    &lt;/add&gt;
    &lt;add switchValue="All" name="General"&gt;
      &lt;listeners&gt;
        &lt;add name="Formatted EventLog TraceListener" /&gt;
      &lt;/listeners&gt;
    &lt;/add&gt;
  &lt;/categorySources&gt;
  &lt;specialSources&gt;
    &lt;allEvents switchValue="All" name="All Events" /&gt;
    &lt;notProcessed switchValue="All" name="Unprocessed Category" /&gt;
    &lt;errors switchValue="All" name="Logging Errors &amp;amp; Warnings"&gt;
      &lt;listeners&gt;
        &lt;add name="Formatted EventLog TraceListener" /&gt;
      &lt;/listeners&gt;
    &lt;/errors&gt;
  &lt;/specialSources&gt;
  </code></pre>
  
  <p></p>