Pawan Nogariya
Pawan Nogariya

Reputation: 8980

MessageLoggingElement.MaxMessagesToLog Property

My WCF service trace file wcf-trace-error.svclog has exceeded size of 325MB+ I want to minimize its size from growing, what I tried is adding this to web.config file of my service

<diagnostics wmiProviderEnabled="true">
      <messageLogging 
           logEntireMessage="true" 
           logMalformedMessages="true"
           logMessagesAtServiceLevel="true" 
           logMessagesAtTransportLevel="true"
           maxMessagesToLog="800" 
       />
</diagnostics>

With the intention that maxMessagesToLog will solve my problem. But I am not completely sure that it will because there is not much description given on msdn for this property

Gets or sets a value that specifies the maximum number of messages to log.

Is this way correct?

And what actually the property does? Does it stop logging once it reaches to the specified number of messages logged?

Upvotes: 0

Views: 1011

Answers (1)

debuggio
debuggio

Reputation: 19

You are correct but not fully.

maxMessagesToLog indicates how many messages your log will store, but it says nothing about their size. Messages could be up to 256k (by default)

Use maxMessagesToLog with maxSizeOfMessageToLog (indicates maximum size of 1 message), so by multiplying maxMessagesToLog with maxSizeOfMessageToLog you can make a sugestion about your log maximum size.

Upvotes: 1

Related Questions