Using the Logging API in Codeless

I am having some trouble using the Logging API in Codeless, I can’t in fact understand what should happen when I add a debug block. I can’t find the channels, I am not sure if I need to create the channels or the loggers in advance. Is there a doc, support item or youtube video that describes a good logging practice?

For example I have 1 codeless API with 2 methods containing Codeless business logic. I would like to create separate loggers for each method.

I am looking for a resource to understand:

  1. What log-levels are used for
  2. The syntax for changing the Log message format
  3. How and when to create separate loggers

Hi @Andreas_Marinopoulos !

I can’t find the channels, I am not sure if I need to create the channels or the loggers in advance

There is no need to specify channels in advance - they will be created dynamically.

For example I have 1 codeless API with 2 methods containing Codeless business logic. I would like to create separate loggers for each method.

You can specify different names for loggers in your Codeless scheme so messages will go to logs via separate loggers.

You can read more about Backendless logging by this link Logging - Backendless REST API Documentation

  1. What log-levels are used for

Log levels are used for ranging messages by their importance. Using logging levels you able to turn off not required logs. For example, your code can contain logging with sevral different levels - ERROR for critical errors, INFO for some general information about execution flow and DEBUG for detailed logging of each aspect of your code. Usually, in production, you will need only ERROR and, sometimes, INFO levels enabled to record critical errors of your code about which you should know and collect some general info. Other logging levels will be ignored. DEBUG level used for detailed investigation of your code and usually enabled on when you require more information about execution flow.
In other words, logging levels allow you to define detailed logging for your code and dynamically configure levels for which you want to receive logs.

  1. The syntax for changing the Log message format

Usually you don’t need to change it. More information about pattern syntax you can find by this link PatternLayout (Apache Log4j 1.2.17 API)

  1. How and when to create separate loggers

Usually separate logger created for part of logic which united by some purpose. For example, in app like Backendless Data Service, File Service, Messaging Service can have separate loggers since their logic grouped by domain model (Data Service works with DB, File Service works with files). I hope you got main idea.

Regards, Andriy

1 Like