简体   繁体   English

Cakephp登录AWS Elastic Beanstalk

[英]Cakephp logs in AWS Elastic Beanstalk

What is the best way to handle logging with cakePHP in an Elastic Beanstalk environment? 在Elastic Beanstalk环境中使用cakePHP处理日志的最佳方法是什么? Normally cakePHP writes the logs to the tmp folder of the application. 通常,cakePHP将日志写入应用程序的tmp文件夹。 However I see no way to access that folder in an Elastic Beanstalk app. 但是,我看不到在Elastic Beanstalk应用程序中访问该文件夹的方法。 Am I missing something or is there a specific way to get the logs of your app. 我是否缺少某些东西,或者是否有特定的方法来获取应用程序的日志。

EDIT: The cakePHP Version I'm using is 2.10.9 编辑:我正在使用的cakePHP版本是2.10.9

You did not mention the version of CakePHP that you are using so I will assume 3.x 您没有提到正在使用的CakePHP版本,因此我假设使用3.x。

On the official cookbook you can see how to create a log adapter and you can then use that to push the logs to the Elastic Beanstalk environment. 在官方食谱中,您可以看到如何创建日志适配器 ,然后可以使用该日志适配器将日志推送到Elastic Beanstalk环境。

If you exted the BaseLog class as the example suggests you have very little code to write. 如果您将BaseLog类作为示例进行了说明,则表明您编写的代码很少。

Next you need to properly configure your new logger in app.php 接下来,您需要在app.php正确配置新的记录器

For CakePHP 2.x you need look at this documentation on how to create a new log stream. 对于CakePHP 2.x,您需要查看有关如何创建新日志流的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM