Writes a log entry with an error severity to the ColdFusion MX logger. The entry includes the severity, thread ID, date, time, and a text message.
Event Gateway Development
error(String message) error(Throwable th) error(String message, Throwable th)
debug, fatal, info, warn, getLogger, Logging events and using log files in Creating Custom Event Gateways in ColdFusion MX Developer's Guide
Parameter | Description |
---|---|
message |
The message to include in the log entry. |
th |
A throwable object, normally an exception. ColdFusion MX logs the exception information in the exception.log file in the ColdFusion MX logs directory. |
Use this method to send an error message to the ColdFusion MX logging subsystem. ColdFusion MX will write a 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).
The ColdFusion MX 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"; }