title: jvm option -Xloggc with %p in systemd.unit gives wrong log filename
body: <p>I have a java process that I want to run with the option:</p>
  
  <pre><code>-Xloggc:/var/log/mylog_%p.gc.log
  </code></pre>
  
  <p>so that the name of the log file contains the PID. For example, if the process has PID 3498, the logfile name is <code>/var/log/mylog_pid3498.gc.log</code>.
  I want the Java process to be initiated by a <strong>systemd unit</strong> file.
  The unit file is:</p>
  
  <pre><code>[Service]
  User=ubuntu
  Type=simple
  WorkingDirectory=/home/ubuntu/my_code
  ExecStart=/usr/bin/java -Xloggc:/var/log/mylog_%%p.gc.log -jar my_code.jar
  Restart=always
  </code></pre>
  
  <p>Note that I have used the <code>%%</code> character to escape the <code>%</code>. However, this does not give the expected result, since I get that the log file has name <code>/var/log/mylog_%p.gc.log</code> , i.e. Java could not do the substitution of <code>%p</code> with the actual PID. </p>
  
  <p>Any idea? Thanks! </p>
  
  <p>Operating system: </p>
  
  <pre><code>Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-1066-aws x86_64)
  </code></pre>
  
  <p>Java version:</p>
  
  <pre><code>java version "1.8.0_181"
  Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
  </code></pre>
  
  <p>systemd version:</p>
  
  <pre><code>systemd 229
  +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN
  </code></pre>