This was asked on cf-talk yesterday but figured it would be a good tip to share here. Is there a way - via code - to determine the location of ColdFusion log files? Yes, via the Admin API:
<cfscript> adminObj = createObject("component","cfide.adminapi.administrator"); adminObj.login("admin");
debugger = createObject("component", "cfide.adminapi.debugging"); logfolder = debugger.getLogProperty("logdirectory"); </cfscript> <cfoutput>#logfolder#</cfoutput>
The first two lines create an instance of the Administrator API CFC and logs in with my password. (And no, 'admin' isn't really my password. It's password.)
The next two lines use the debugging CFC to run getLogProperty("logdirectory"), which as you can guess, gets the log directory value.