Determining the location of ColdFusion's log files

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> </code>

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.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments