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:

public function trace( message:String ):void
public function debug( message:String ):void
public function info( message:String ):void
public function warn( message:String, exception:Error = null ):void
public function error( message:String, exception:Error = null ):void
public function fatal( message:String, exception:Error = null ):void

where:

Argument                Description
message the message to log.
exception an exception or error to log. Backendless logs a stack trace for the exception.

Example

Logger logger = Backendless.Logging.GetLogger( "com.mbaas.Logger" );
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

Codeless Reference

logging_api_log_a_message_1

where:

Argument                Description
logger name Represents a unique identifier assigned to a logger, which serves as a gateway for submitting client-side log messages. Each logger can represent a specific UI screen name or functional area within the application.
log channel Identifies a specific logging level, available options are: DEBUG, INFO, WARN, ERROR, FATAL, TRACE.
log message Specify the log message to be saved in the log file.

The example below creates a new logger with the name "event_listener_create", sets the logging level to DEBUG and saves the log message to the log file.

logging_api_log_a_message_2

After the Codeless logic runs, the log gets printed to the REAL-TIME LOGGING interface:

logging_api_log_a_message_3