Skip to content

Logging a message

This API logs a message and or error to the server. If the log buffer is configured, the message is stored in it for subsequent flush, otherwise, the log message is delivered to the server.All methods are available on the logger object retrieved using the method described above:

Backendless.Logging.getLogger(loggerName).debug(message);
Backendless.Logging.getLogger(loggerName).info(message);
Backendless.Logging.getLogger(loggerName).warn(message);
Backendless.Logging.getLogger(loggerName).warn(message, exception);
Backendless.Logging.getLogger(loggerName).error(message);
Backendless.Logging.getLogger(loggerName).error(message, exception);
Backendless.Logging.getLogger(loggerName).fatal(message);
Backendless.Logging.getLogger(loggerName).fatal(message, exception);
Backendless.Logging.getLogger(loggerName).trace(message);

where:

Argument                Description
message the message to log.
exception an exception or error to log. Backendless logs a stack trace for the exception.
loggerName any string value which identifies the logger.

Example

Backendless.Logging.getLogger("com.mbaas.Logger").info("Starting application..");

Once the example runs, the Manage > Log Management screen in the Backendless Console will show the following:
log-file-sample.zoom50