A quick block of code to demonstrate how to generate a stack trace from within ColdFusion. Using the server monitor API it is a fairly simple process.
2<cfobject component="cfide.adminapi.administrator" name="admin">
3<cfobject component="cfide.adminapi.servermonitoring" name="sm">
4
5<cfset admin.login('YOURADMINPASSWORD')>
6<cfset filename = sm.dumpSnapShot()>
7<cfoutput>
8Snapshot was placed in: #filename#
9</cfoutput>
The code calls the login function passing in your ColdFusion Admin password in order to get access to the Admin API.
The dumpSnapShot function will create the stack trace and return the file path of the snapshot. The default location is usually ../web-inf/cfusion/logs/snapshots.
You might want to prompt for a password versus hardcoding in the tag as well.


There are no comments for this entry.
[Add Comment] [Subscribe to Comments]