Skip to content

Configuring log buffer policy

The log buffer policy controls the following aspects of log message submission from the client app to the server:

  • the maximum number of log messages stored in the buffer
  • the maximum time interval (in seconds) between message transmissions

The log exhibits the behavior defined below based on the configuration parameters established with the API:

  • flushes the log messages to the server when the maximum of messages have been collected
  • flushes the messages after the configured time interval elapses
  • delivers log messages immediately if the number of messages is set to 0 (zero)

To configure a log buffer policy, include the following in your application. The method is available via the Backendless.logging accessor:

Backendless.Logging.setLogReportingPolicy( numOfMessages, timeFrequencySec )

where:

Argument                Description
numberOfMessages sets the maximum limit for the number of messages.
timeFrequencySec time frequency/interval in seconds defining how often log messages from the buffer should be flushed to the server. The value of zero indicates immediate delivery of messages to the server, bypassing the buffer.

Example

The example below configures a log buffer policy for 100 messages and a 60 second flush time.

Backendless.Logging.setLogReportingPolicy(100, 60);

Codeless Reference

logging_api_logging_policy_1

where:

Argument                Description
Number of log messages Specify the maximum number of log messages to be stored in the buffer.
Flush frequency Identifies the time interval in seconds when the messages are flushed.

The example below configures a log buffer policy for 100 messages and a 60 second flush time.

logging_api_logging_policy_2