How to log from FiddlerScript

1,139 views
Skip to first unread message

Ray Darrow

unread,
Aug 13, 2014, 6:29:50 PM8/13/14
to httpf...@googlegroups.com
I have a problem I'm trying to debug with there being too many cookies by the time a user gets to our checkout page.  I've written a script to detect every time a cookie is set via set-cookie header or a javascript file with document.cookie = something is sent to the client.  I need the url, cookie name, expiration, domain, and path.  I've got the script getting all the data I need, but I can't figure out how to write it to a log file.

I can do streamwriter, but run into file locking issues because there are multiple threads for different requests.  Is there a threadsafe way to log built in?  I can't figure out how to use log4net or nlog from inside fiddlerscript.  I guess the other option is to make my cookies arraylist object global and just keep adding the cookies to it and then write it all out at once at end.  If I choose that direction how would I trigger it writing out the log when I was ready?  Thanks for your help.

- Ray

EricLaw

unread,
Aug 14, 2014, 12:28:34 PM8/14/14
to httpf...@googlegroups.com

You can also just do FiddlerApplication.Log.LogFormat(...) to log to Fiddler's log file, then save out that log whenever you like. You can also trigger it to save automatically by logging a "magic" string:

    @Log.Export \"C:\\temp\\filename.rtf\"

Ray Darrow

unread,
Aug 14, 2014, 5:28:14 PM8/14/14
to httpf...@googlegroups.com
Awesome.  That did the trick.  I never would have got the magic string trick.  Thanks.
Reply all
Reply to author
Forward
0 new messages