[英]Application Logging for elastic beanstalk
I have Spring MVC application running on aws ec2. 我在aws ec2上运行了Spring MVC应用程序。 Now I have decided to move to aws elastic beanstalk and yet exploring it before migrating current application.
现在我决定转移到aws弹性beanstalk,然后在迁移当前应用程序之前进行探索。 I had few questions regarding persistent storage and application logging.
我对持久存储和应用程序日志记录的问题很少。
My question could be naive but please bear with it :) 我的问题可能很幼稚,但请耐心等待:)
I am using log4j for application logging. 我正在使用log4j进行应用程序日志记录。 Log4j appends logs at specified location on hard drive.
Log4j将日志附加到硬盘驱动器上的指定位置。 As elastic beanstalk has no persistent storage (storage will be deleted once instance is terminated) and instances may grow/shrink based on the load rules.
由于弹性beanstalk没有持久存储(一旦实例终止,存储将被删除),实例可能会根据加载规则增长/缩小。
So I am stuck at the following 所以我被困在以下
I have been going through articles describing use of .ebextensions directory. 我一直在阅读描述.ebextensions目录使用的文章。 I tried using basic .conf files provided by AWS to tail logs to S3 but no success for my application logs.
我尝试使用AWS提供的基本.conf文件将日志记录到S3,但我的应用程序日志没有成功。
Sample script to create application directory places under .ebextensions 用于在.ebextensions下创建应用程序目录的示例脚本
commands:
01_create_dir:
test: test ! -d "${DIR}"
command: mkdir "${DIR}"
Referred links : 推荐链接:
EBS console displays apache logs for URL access. EBS控制台显示用于URL访问的apache日志。
I would like to know if there is any ready-made solution provided by AWS already that I failed to search. 我想知道AWS是否已经提供了我未能搜索的现成解决方案。
From http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-platform.html : 来自http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-platform.html :
Standard output and error streams from processes started with a Procfile are captured in log files named after the process and stored in /var/log.
使用Procfile启动的进程的标准输出和错误流将在以进程命名的日志文件中捕获并存储在/ var / log中。 For example, the web process in the preceding example generates logs named web-1.log and web-1.error.log for stdout and stderr, respectively.
例如,前面示例中的Web进程分别为stdout和stderr生成名为web-1.log和web-1.error.log的日志。
Based on that, all you have to do is ensure log4j / logback outputs the logs you want to stdout, ie CONSOLE
. 基于此,您所要做的就是确保log4j / logback输出您想要stdout的日志,即
CONSOLE
。 With Spring Boot this is the default behavior. 使用Spring Boot,这是默认行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.