Remote logging problem with MaxElementsInBuffer property

Topics: Logging Application Block
May 31, 2011 at 10:54 AM

 

Hi,

I have a question about the MaxElementsInBuffer property of RemoteServiceTraceListener.

In the case where log entries written in the specified SubmitInterval are more than the MaxElementsInBuffer value, only the last MaxElementsInBuffer log entries are sent to the server and we lose the remaining. Is there any way to customize this process and not lose any log entries.

Nurullah

May 31, 2011 at 12:02 PM

Hi Nurullah,

I would think this is really what is by design with the MaxElementsInBuffer property. As per documentation the main purpose of this is - "This buffering is used when messages should be sent in a batch, or when log messages cannot be sent for some reason (for example when the Internet connection is lost).". Therefore I would think the only thing you can do to workaround on your scenario is either have a considerable SubmitInterval (that would not allow your Buffer size to be full) or increase your MaxElementsInBuffer value. Hope this make sense.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

 

 

May 31, 2011 at 9:20 PM

The space on the client to store buffered messages (Isolated storage) is very limited in size, AND must be shared between everything in the app that uses iso storage. As such, there's no way to guarantee that all unsent messages are saved, since iso storage could simply fill up. As such, the MaxElementsInBuffer works the way it does to help you decide how much of iso storage you want to reserve for logging messages, and to force you to think about the scenario where things are going to get tight.

 

Jun 1, 2011 at 7:13 AM

Hi,

Thank you for your answers. It is expected that MaxElementsInBuffer limits the number of elements stored in isolated storage when the connection is lost. I have no problem with that. But in my case, let's say MaxElementsInBuffer=50, if I try to write 100 logs in the stated SubmitInterval, although the connection is up, only the final 50 entries are sent to server. But what I want is to send all entries. Whenever the buffer is full, it should send all entries in buffer to server(the first 50 log entries for my example) and clear the buffer so that it can be filled with the next log entries. I am wondering whether this can be achieved or not.

Nurullah

Jun 2, 2011 at 10:07 AM

Hi Nurullah,

I would think this is not the way it will work for now. I am thinking that this may probably be able to achieve by creating a Custom Remote Service Tracelistener but unfortunately I don't know yet if this is easily supported by the Silverlight Integration pack same with the desktop version. What I can suggest is, you can add this as a feature request for now for the Silverlight Integration Pack. You can log this in the issue tracker and vote for it. HTH.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com