Slow performance using LAB to write logs to Message Queue

Topics: Logging Application Block
Sep 15, 2009 at 7:39 PM
Edited Sep 16, 2009 at 1:39 PM

I'm using LAB for a new project at work. We already use it in production for other apps.

Performance for certain task were taking 80+ seconds to process. This did not see correct because testing was very fast.

Anyways, the culprit turned out to be the LAB that send message to a Message Queue. I found this out by removing all logging from my application.

The process time went from 80+ seconds to 3 seconds!

Is there some kind of problem sending a large number of logs to a queue using the LAB?

Note: We are logging 50 thousand lines of data in one file and have multiple files.


Let me know if you need any code or more details! Thanks!

Sep 16, 2009 at 4:02 AM
Edited Sep 16, 2009 at 5:18 AM


Yes. Can you provide more details and some code to repro your scenario. Also, you said that you've removed the LAB that send the messages to message queue, what did you used to compensate the functionality of the LAB?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.

Sep 16, 2009 at 2:01 PM
Edited Sep 16, 2009 at 2:02 PM

Here is the code I use to send log messages to the Message Queue:

Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry log = new Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry();
log.Message = message;
log.EventId = eventId;
log.Severity = severity;
log.ExtendedProperties = additionalInfo;
log.TimeStamp = DateTime.Now;

When I said I removed LAB, I just commented out this line of code: "Logger.Write(log);". I just turned off all logging by doing that because all my application logging calls will run the above code.

Here are the App.config settings:

    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral" />
  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
    defaultCategory="" logWarningsWhenNoCategoriesMatch="true">
      <add name="Msmq TraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.MsmqTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral"
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.MsmqTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral"
        traceOutputOptions="None" filter="All" queuePath=".\Private$\Logging"
        formatter="Binary Formatter" messagePriority="Normal" timeToReachQueue="49710.06:28:15"
        timeToBeReceived="49710.06:28:15" recoverable="false" useAuthentication="false"
        useDeadLetterQueue="false" useEncryption="false" transactionType="None" />
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.BinaryLogFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral"
        name="Binary Formatter" />
      <add switchValue="All" name="DEBUG">
          <add name="Msmq TraceListener" />
      <add switchValue="All" name="ERROR">
          <add name="Msmq TraceListener" />
      <add switchValue="All" name="TRACE">
          <add name="Msmq TraceListener" />
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings" />

Note: I have added Database Logging references to enable but am not currently using it at all.

Sep 17, 2009 at 5:56 AM
Edited Sep 17, 2009 at 6:00 AM


I see. I thought that you've replace the said functionality with the .NET way of sending messages to message queue :) . I think it would be a expected that it would take some time to process those large number of logs.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.