$ pip install coralogix_logger
Using Coralogix SDK requires four mandatory parameters and one optional parameter:
private_key (String): The private key is the password for your company, used to validate your authenticity. This key will be sent to your mail once you register to Coralogix.
application (String): The name of your main application. For example, a company named Startup which develops app_1 and app_2 can use “Startup app_1” and “Startup app_2” for this parameter; or if they want to debug their test environment they might insert the “Startup app_1 – Test” or “Startup app_1 – Staging”.
subsystem (String): The name of your sub-system. Your application probably has multiple sub-systems, e.g. “Backend servers”, “Middleware”, “Frontend servers”, “Database servers” etc. In order to help you examine only the data you need, inserting the subsystem parameter is vital.
computer_name (String): Optional. When several servers run the same application/subsystem, you will enjoy the full power of Coralogix if you use a different computer_name per server.
Python implementation example:
By default, uWSGI does not enable threading support within the Python interpreter core. This means it is not possible to create background threads from Python code. As the Coralogix logger relies on being able to create background thread (for sending logs), this option is required.
You can enable threading either by passing –enable-threads to uWSGI command line:
$ uwsgi wsgi.ini --enable-threads
Another option is to enable threads in your wsgi.ini file:
enable-threads = true
If you are using multiple processes/workers and you don’t use “lazy-apps = true” then you must wait for the process to finish the fork before you can send logs with Coralogix logger.
You can configure the logger during initialization process but you must wait for the fork to complete before you can actually send your logs.
You can use uWSGI @postfork decorator to be sure when it’s safe to use Coralogix logger:
Need help? We love to assist our customers, simply book your implementation session, and we will walk you through, step by step.