From: "Chris Norloff" <[EMAIL PROTECTED]>
> I'd like to save the application.log file regularly, then delete the file
> from the log directory - this is to keep the log for future reference 
>but not have a single monster-sized file.
> 
> Ideas?
> 

You want to complete your operation with the least chance of losing
any new log entries --- so,

<cfset tmp=Now()>
<cfset fileDate=DateFormat(tmp,"mm_dd_yyyy")>
cfset fileTime=TimeFormat(tmp,"HH_mm_ss")>
<cfset fileDir="c:\cfusion\logs\">
 <!--- change fileDir to your dir --->
<cfset fileName="application.log">
<cfset fileNamePrefix=fileDate & "_" & fileTime & "_">
<cfset srcFile=fileDir & fileName>
<cfset destFile=fileNamePrefix & srcFile>
<cfset archiveDir="c:\cfusion\logs\archive\"> 
<!--- change archiveDir to your dir --->
<cfset archFile=ReplaceNoCase(destFile,fileDir,archiveDir)>
<cffile action="rename"
  source="#srcFile#"
  destination="#destFile#">
<cffile action="move"
  source="#destFile#"
  destination="#archFile#">

The rename means application.log is wiped and will be recreated
 on the next log write. The extra "_" in fileNamePreFix means you
 have a nice list to parse with a delimiter of "_", if you need to 
collect, search, etc. any files in /archive/ by DatePart() The "_"
is least likely to cause hairballs in re filenaming.

Code is not checked for missspletings, and not guaranteed as
VulcanLogicProof as written. (I.E., never run code as received
from outside sources until you have proofed it on a development
machine.)

Pan

p.s.

There is a small chance the rename will occur at the exact same
quantum moment as a log write - see list entries, en passant, for
discussion on applying Poisson Probability Formulas.
 
I say 'quantum' as hardware lives by a digitized time frame
comprised of a sequence of clocked timeslices. Those discussing
simultaneous hit probs will eventually grind down to the
realization that the interstitial defined by the rising or
falling edges of their internal clock signal creates infintesimal
zones of no-time, thus making it necessary to slightly refine
their calculations. They'll end up with second order Planckian
wave probability functions - which are not fun to turn into
real  and meaningful numbers. I could be totally wrong about
this.

I wonder if anyone reads this parenthetical post scriptum stuff?




------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to