classic asp log

Hi ! I would like to get some log on text file.
Like on my classic asp page when a button is click, I want to record some thing like
"Quote is created on 01/01/2017 12:23" and the file directory is: C:\QA Logs\log.txt
And I want to accumulate so I can check all the records.

How can I do that in classic asp?

I have no idea how it work in classic asp. so simple better :-)
LVL 1
ITsolutionWizardAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
Here's a pretty straight forward example on how to create a log file. You can change it around to save whatever info you want, but it should at least get you started. If you have any specific questions feel free to ask.

http://www.devasp.com/samples/logfile.asp
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Make sure you give write permissions to C:\QA Logs\ for your web user or you will get a permissions error.  The code below assumes you already have a file named, C:\QA Logs\log.txt and is modified from  http://www.4guysfromrolla.com/webtech/faq/FileSystemObject/faq3.shtml

<%
' Append a log file to C:\QA Logs\log.txt 
' "Quote is created on 01/01/2017 12:23"
' http://www.4guysfromrolla.com/webtech/faq/FileSystemObject/faq3.shtml

Const fsoForAppend = 8

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Open the text file
Dim objTextStream
Set objTextStream = objFSO.OpenTextFile("C:\QA Logs\log.txt", fsoForAppend)

'Display the contents of the text file
objTextStream.WriteLine "Quote is created on "&now


'Close the file and clean up
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing

%>

Open in new window

I suggest making this an include file and that way you can insert the include file anywhere you need it and if you ever need to make a change, you change only one file.

You can add it to a page where you accept the form data directly or if you are  using ajax, include it in your ajax page.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.