在哪里可以找到刺槐原木? [英] Where can I find locust logs?
问题描述
我正在使用蝗虫对我们的应用程序进行压力测试.
I'm using locust to stress test our app.
我收到了错误消息,因为POST调用似乎不正确.在哪里可以看到刺槐的日志?我想看看邮寄电话的样子,看看有什么问题.
I'm getting errors because the POST call seems incorrect. Where can I see the logs for locust? I'd like to see what the post call looks like to see what's wrong.
这是我的代码,以防有人告诉我我做错了什么:
Here's my code in case someone can tell me what I'm doing wrong:
from locust import HttpLocust, TaskSet, task
json3 = """{"stack_name": "beenz-php-app-12", "disable_rollback": true, "template": "php", "timeout_mins": 60}"""
class MyTaskSet(TaskSet):
@task
def send(self):
response = self.client.post("/stacks", json3, headers={'X-Auth-Key': 'xxxx', 'Content-Type': 'application/json', 'X-Auth-User': 'xxxx', 'Accept': 'application/json', 'X-Auth-Token':'xxxx'})
print "Response status code:", response.status_code
print "Response content:", response.content
class MyLocust(HttpLocust):
task_set = MyTaskSet
min_wait = 5000
max_wait = 15000
谢谢!
推荐答案
通过在蝗虫启动时添加--logfile=locustfile.log
参数,您的print
消息将被重定向到名为locustfile.log
的文件,我认为这是 log .
By adding --logfile=locustfile.log
parameter when starting locust, your print
messages will be redirected to a file called locustfile.log
, which I think is the log you mentioned in your question.
假设您的蝗虫文件名为locustfile.py
.然后您在本地计算机上运行蝗虫.您可以通过locust --host=http://127.0.0.1 --logfile=locustfile.log
启动蝗虫.然后,您将可以在http://127.0.0.1:8089/
上运行蝗虫测试.
Suppose your locust file name is locustfile.py
. And you run locust on your local machine. You can start locust by locust --host=http://127.0.0.1 --logfile=locustfile.log
. Then you'll be able to run locust test on http://127.0.0.1:8089/
.
这篇关于在哪里可以找到刺槐原木?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!