启用垃圾收集日志记录与弹性青苗的Tomcat

问题描述 投票:3回答:1

在我terraform部署我的设置

  setting {
    namespace = "aws:elasticbeanstalk:container:tomcat:jvmoptions"
    name = "Xms"
    value = "2048m"
  }

  setting {
    namespace = "aws:elasticbeanstalk:container:tomcat:jvmoptions"
    name = "Xmx"
    value = "2048m"
  }

  setting {
    namespace = "aws:elasticbeanstalk:container:tomcat:jvmoptions"
    name = "JVM Options"
    value = "-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution -Xloggc:log/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=100M"
  }

在容器的选择,我可以看到,被应用在XmsXmx和GC设置。但是,当我从容器中下载完整的日志我找不到任何地方GC日志。可能是什么问题?我看与普通GC安装的answer,但它并不在我的情况下工作。我用Tomcat 8.5 with Java 8 running on 64bit Amazon Linux/3.1.0

enter image description here

java garbage-collection tomcat8 terraform amazon-elastic-beanstalk
1个回答
1
投票

你所面临的问题是许可。您tomcat用户下启动该服务,因此不能访问该路径来创建日志。

试试这个-Xloggc:/var/log/tomcat8/gc.log

© www.soinside.com 2019 - 2024. All rights reserved.