Skip to content


Custom server-side code can log information using the API provided by Backendless SDK for JavaScript.

/* global Backendless */

Backendless.ServerCode.Persistence.beforeCreate('Order', function(req) {
    Backendless.Logging.setLogReportingPolicy( 1, 1 );
    var logger = Backendless.Logging.getLogger( "MyLogger"); "informational log message" ); 
    logger.warn( "warning message" ); 
    logger.debug( "debug message" ); 
    logger.error( "error message" ); 
    req.item.customername = req.item.customername.toUpperCase();

It is important to note that using logging in custom server-side code requires a special configuration of the logging policy using the following API. This is required to avoid creation of a log buffer and an additional thread responsible for submission of the log messages to the Backendless servers:

Backendless.Logging.setLogReportingPolicy( 1, 1 );

The sample code above logs four different messages, each for separate logging level. The log levels are organized into a hierarchy:

Log level
Includes messages from log levels
debug, info, warn, error
info, warn, error
warn, error

The log file is saved in the /logging directory of the Backendless File Service storage.

The following logging APIs are available:

Retrieving Logger object:

Backendless.Logging.getLogger( loggerName );

Log a message with the debug level:

loggerObject.debug( message );

Log a message with the info level: message );

Log a message with the warn level:

loggerObject.warn( message );

Log a message with the error level:

loggerObject.error( message );