0

Trying to add the following option under sonar.properties

sonar.web.javaOpts=-Xmx1g -Xms1g -XX:MaxPermSize=160m -XX:+PrintCommandLineFlags -Djava.net.preferIPv4Stack=true \
 -Xloggc:"/data/sonarqube/logs/gc-$(date +%Y-%m-%d_%H%M).log" -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 \
 -XX:GCLogFileSize=10M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/sonarqube/logs

But sonarqube fails to start with following message

Error: Could not find or load main class +%Y-%m-%d_%H%M).log

Not sure how to make the evaluation happen can anybody help ?

Thanks ravi

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
RA123
  • 1

1 Answers1

0

Script variable substitution $(date...) is not supported as this property is not read/executed by shell.

Anyway I don't think this is the correct way to rotate GC logs as the filename would be resolved only once when starting application. -Xloggc:/data/sonarqube/logs/gc.log is enough. Rotation index is automatically appended to filename (gc.log.0 for instance). See https://stackoverflow.com/a/12277309/229031 and http://bugs.java.com/view_bug.do?bug_id=6941923 for more details.

Community
  • 1
  • 1
Simon Brandhof
  • 5,137
  • 1
  • 21
  • 28