Defined in Application.cfc, invoked when the application times out or when the server is shutting down.

function onApplicationEnd(applicationScope) { } → returns boolean

Argument Reference

ApplicationScope struct

The application scope of the application that is ending.

Sample code invoking the onApplicationEnd function

Write to the log that application has ended. In the example below, text 'myApp ended on {current date/time}' gets added to D:\CF\logs\myApp.log file. Note: Application has already ended, but we can use ApplicationScope argument to access any Application scope variables.

public void function onApplicationEnd(struct ApplicationScope){

		writeLog(text = "#arguments.ApplicationScope.name# ended on: #now()#");
		return true;

Fork me on GitHub