Enhancement - Save/load request logs to/from disk #34

Closed
opened 2025-12-29 14:21:23 +01:00 by adam · 5 comments
Owner

Originally created by @phillee007 on GitHub (Aug 12, 2017).

Just thinking, in one of the scenarios we have, the Wiremock standalone instance is used as either:

  • a fallback when one of our real services goes down in development, or
  • we just want to avoid depending on the real service.

Sometimes the service can run for days, or weeks. When this happens and there are multiple developers using the standalone mock service, the request logs can grow very large, and use a lot of memory. To address this, one option would be to manually clear them, however I was thinking I might (this will likely not be till October when I get back from holiday) instead provide a setting to have the request logs saved to disk instead, much like the mappings, and then when requests come to retrieve a log entry or a search, parse the files and return the matching ones.

Another scenario I can see this being useful for is where there is a long-running proxy/record instance.

I'm thinking that the RequestLogs collection could be changed into a custom List or IEnumerable implementation, which just stores the request id and filename. When GetEnumerator or other methods are called, it would then read the actual request files from disk and return them.

An alternative option would be to provide a setting such as RequestLogExpirationDuration, or MaxRequestLogCount, which could be used to ensure that request logs are purged when they reach a certain age, or when a certain amount build up. This might be easier, but is another way to address the same issue.

Thoughts Stef?

Originally created by @phillee007 on GitHub (Aug 12, 2017). Just thinking, in one of the scenarios we have, the Wiremock standalone instance is used as either: - a fallback when one of our real services goes down in development, or - we just want to avoid depending on the real service. Sometimes the service can run for days, or weeks. When this happens and there are multiple developers using the standalone mock service, the request logs can grow very large, and use a lot of memory. To address this, one option would be to manually clear them, however I was thinking I might (this will likely not be till October when I get back from holiday) instead provide a setting to have the request logs saved to disk instead, much like the mappings, and then when requests come to retrieve a log entry or a search, parse the files and return the matching ones. Another scenario I can see this being useful for is where there is a long-running proxy/record instance. I'm thinking that the RequestLogs collection could be changed into a custom List or IEnumerable implementation, which just stores the request id and filename. When GetEnumerator or other methods are called, it would then read the actual request files from disk and return them. An alternative option would be to provide a setting such as RequestLogExpirationDuration, or MaxRequestLogCount, which could be used to ensure that request logs are purged when they reach a certain age, or when a certain amount build up. This might be easier, but is another way to address the same issue. Thoughts Stef?
adam added the feature label 2025-12-29 14:21:23 +01:00
adam closed this issue 2025-12-29 14:21:23 +01:00
Author
Owner

@StefH commented on GitHub (Aug 12, 2017):

For this scenario I think implementing RequestLogExpirationDuration / MaxRequestLogCount is the easiest.

About memory issues : I dont think that will be a real issue unless you send/receive complete byte[] array blob data like complete files.

Note that I'm currently working on using netstandard/netcore 2.0 preview in relation to docker image.
My goal is to create a docker image based on linux or windows nano to run wiremock.net in a container.

@StefH commented on GitHub (Aug 12, 2017): For this scenario I think implementing RequestLogExpirationDuration / MaxRequestLogCount is the easiest. About memory issues : I dont think that will be a real issue unless you send/receive complete byte[] array blob data like complete files. Note that I'm currently working on using netstandard/netcore 2.0 preview in relation to docker image. My goal is to create a docker image based on linux or windows nano to run wiremock.net in a container.
Author
Owner

@StefH commented on GitHub (Aug 14, 2017):

@phillee007 ; another question : are you available for code-reviews in the next weeks? Or do you have holiday planned?

@StefH commented on GitHub (Aug 14, 2017): @phillee007 ; another question : are you available for code-reviews in the next weeks? Or do you have holiday planned?
Author
Owner

@phillee007 commented on GitHub (Aug 14, 2017):

I go on holiday to Europe in a few days till October 5, but should be able
to look at some code while on planes/buses etc. Is it for the core 2 stuff?

Phil

On 14/08/2017 7:27 PM, "Stef Heyenrath" notifications@github.com wrote:

@phillee007 https://github.com/phillee007 ; another question : are you
available for code-reviews in the next weeks? Or do you have holiday
planned?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/WireMock-Net/WireMock.Net/issues/42#issuecomment-322117905,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEEFow23fKvRYnCT-CYqzsPRP0D4l_XKks5sX_bOgaJpZM4O1XOe
.

@phillee007 commented on GitHub (Aug 14, 2017): I go on holiday to Europe in a few days till October 5, but should be able to look at some code while on planes/buses etc. Is it for the core 2 stuff? Phil On 14/08/2017 7:27 PM, "Stef Heyenrath" <notifications@github.com> wrote: > @phillee007 <https://github.com/phillee007> ; another question : are you > available for code-reviews in the next weeks? Or do you have holiday > planned? > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/WireMock-Net/WireMock.Net/issues/42#issuecomment-322117905>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AEEFow23fKvRYnCT-CYqzsPRP0D4l_XKks5sX_bOgaJpZM4O1XOe> > . >
Author
Owner

@StefH commented on GitHub (Aug 14, 2017):

Hi Phil,

Code reviews are more related to https://github.com/WireMock-Net/WireMock.Net/issues/42 and https://github.com/WireMock-Net/WireMock.Net/issues/43

For the .net preview 2.0 stuff, I don't specifically need your review comments, most code-changes are done now I hope.

BTW : where are you going for holiday ?

@StefH commented on GitHub (Aug 14, 2017): Hi Phil, Code reviews are more related to https://github.com/WireMock-Net/WireMock.Net/issues/42 and https://github.com/WireMock-Net/WireMock.Net/issues/43 For the .net preview 2.0 stuff, I don't specifically need your review comments, most code-changes are done now I hope. BTW : where are you going for holiday ?
Author
Owner

@phillee007 commented on GitHub (Aug 14, 2017):

Ok. Just let me know if/when you need me to have a look. I could write the code too when i get back if you're busy.

Holiday - Greece, Croatia, Italy, Hungary, Serbia :-)

@phillee007 commented on GitHub (Aug 14, 2017): Ok. Just let me know if/when you need me to have a look. I could write the code too when i get back if you're busy. Holiday - Greece, Croatia, Italy, Hungary, Serbia :-)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#34