ColdFusion now supports a CFC with an onServerStart method that runs only when the server starts. The onServerStart method takes no parameters, and is the only function in the CFC. The function is useful for application-independent tasks, such as instantiating the applications, configuring logging, or setting up the scheduler.
By default, ColdFusion looks for the onServerStart method in
To specify a different filepath:
Launch ColdFusion Administrator.
Click ColdFusion Administrator Server Settings > Settings.
Specify the absolute filepath under the web root on the Settings page such as c:\Server.cfc. Alternatively, you can use a dot-delimited path under the web root, such as a.b.Server.
You select an option on the Settings page to enable and disable the onServerStart method. By default, the method is disabled.
You can also specify a timeout limit (in seconds) for the onServerStart
method. The timeout limit determines the duration for which the
method would be allowed to run during server start up. This setting
can be specified in
onServerStart method can use most CFML features,
but not any features that require full server start. For example,
the method cannot use a
cfhttp tag with a URL that
specifies a location on the same server. You also cannot use Application
or Request scope variables in the method.
By default, all errors, including any serverCFC errors, are logged
for standalone and
for J2EE configurations.
You can also specify a different location for logging by configuring the log directory setting in ColdFusion Administrator > Debugging and Logging > Logging Settings.
The server.log file contains server startup information. So,
any server.CFC startup errors are logged in it, but for details
about the error, you have to see the exception.log file. In addition,
server startup information is logged in
For WebSphere, it is logged in the
and for JRun, it is logged in