Does CFFile Read lock the file?

Hi,

I have an .NET application which is constantly writing to a log file. I want to write a ColdFusion application that can parse that log file and determine if any errors have been recorded.

I am worried about a sharing violation. Does the ColdFusion CFFile action = "read" command place an exclusive lock on the file that would prevent the .NET application from continuing to write to it?

Any ideas? Can I make a copy of the file temporarirly and parse the copy? Or does CFfile action ="copy" have the same locking problem?

Thanks so much!
LVL 1
jsimonuchcAsked:
Who is Participating?
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.

reitzenCommented:
CFFILE does not put an exclusive lock on the file you want to read.  You may, however, run into a sharing violation if your .NET app is writing to the file when your CF app is reading the file.  To work around this you may want to use CFLOCK.  If .NET cannot detect and work with CF's CFLOCK, then you may want to try a work around that might work like this:

Before CF reads log file, write an empty file "log.reading".
Then CF can read the log file.
CF would then delete the temp file "log.reading".

While this is going on, before .NET writes to your normal log file, it can check to see if the "log.reading" file exists.  If it does exist, hold the log entry(ies) and check back in a X second interval.

HTH
0
jsimonuchcAuthor Commented:
Unfortunately, I do not have access to the .NET application's code. I cannot make any changes to that application or the way it reads/writes the log file.

the problem you are describing "You may, however, run into a sharing violation if your .NET app is writing to the file when your CF app is reading the file." is exactly what I am worried about.
0
reitzenCommented:
Depending on the size of the file, your best bet may be to copy the file and then read it into CF.

There is another post that may provide you with the solution you are looking for.  Read the Accepted Solution at the bottom from black0ps

http://www.experts-exchange.com/Software/Server_Software/Web_Servers/ColdFusion/Q_21459109.html


0

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
jsimonuchcAuthor Commented:
alright, let me look into that and I'll let you know.
0
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
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.