I have found a way to create log files on LocustIO. It successfully writes all logs in the file.
Is there a way that the terminal display the logs and writes it on the log file as well? Just so I could easily monitor the results without opening the log file every time.
Tried programmatically but still does not print it.
Nothing prints after running locust -f my_locust_file.py --logfile=locustfile.log
@task(1)
def fetch_records(self):
...
response = self.client.get(full_result, auth=login_creds, headers=headers)
entry_log = "Fetch Records | Username: {}\tPassword: {} | Response: {}".format(self.username, self.password, response)
logging.info(entry_log)
print(entry_log)
UPDATE
Tried using python loggers as well and running locust -f my_locust_file.py
without --logfile
. It is displaying in console but not outputting in logfile.
def on_start(self):
logging.basicConfig(filename=my_logfile, level=logging.INFO)