Whatever message this page gives is out now! Go check it out!

error

Last update:
May 18, 2026

Description

Writes a log entry with an error severity to the ColdFusion logger. The entry includes the severity, thread ID, date, time, and a text message.

Category

Event Gateway Development

Syntax

error(String message) error(Throwable th) error(String message, Throwable th)

See also

debug fatal info warn getLoggerLogging events and using log files in  Building an event gateway  in the Developing ColdFusion Applications

Parameters

ParameterDescription
message
The message to include in the log entry.
th
A throwable object, normally an exception. ColdFusion logs the exception information in the exception.log file in the ColdFusion logs directory.

Usage

Use this method to send an error message to the ColdFusion logging subsystem. ColdFusion writes messages with a severity of "error" to the log file specified in the getLogger method that returned the Logger instance (or the default log file).

Example

The ColdFusion example SocketGateway class includes the following code in the outgoingMessage method. It writes an error message if the message's originator ID does not correspond to an open socket.
SocketServerThread st = ((SocketServerThread)socketRegistry.get(cfmsg.getOriginatorID())); if(st != null) st.writeOutput(message); else { log.error("Cannot send outgoing message. OriginatorID '" + cfmsg.getOriginatorID() + "' is not a valid socket id."); retcode="failed"; }

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page