Python salt cloudclient is not logging anything

154 Views Asked by At

I am trying to create new nodes using the CloudClient in saltstack python API. Nodes are created successfully but I don't see any logging happening. Below is the code which I am using.

from salt.cloud import CloudClient
cloud_client = CloudClient() 
kwargs = {'parallel': True}
cloud_client.map_run(path="mymap.map",**kwargs)

Is there way to run the same code in debug mode to see the output on console from this python script if logging cannot be done.

logging parameters in cloud

log_level: all
log_level_logfile:  all
log_file: /var/logs/salt.log

When I try to run with sal-cloud on cli it is working with the below command:

salt-cloud -m mymap.map -P
1

There are 1 best solutions below

0
On

I was able make it work by adding the below code

from salt.log.setup import setup_console_logger 
setup_console_logger(log_level='debug')