title: Spring Boot Linux service Log File
body: <p>I have a spring boot uber/fat jar which is set up as a linux service and started using the below command</p>
  <pre><code>systemctl start servicename
  </code></pre>
  <p>The spring boot jar has the below log file configuration</p>
  <pre><code> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
   &lt;configuration&gt;
      &lt;include resource=&quot;org/springframework/boot/logging/logback/defaults.xml&quot;/&gt;
      &lt;property name=&quot;LOG_FILE&quot; value=&quot;logs/spring.log&quot;/&gt;
  
      &lt;include resource=&quot;org/springframework/boot/logging/logback/file-appender.xml&quot;/&gt;
      &lt;include resource=&quot;org/springframework/boot/logging/logback/console-appender.xml&quot;/&gt;
  
      &lt;property name=&quot;SPECIAL_FILE_NAME&quot; value=&quot;special&quot;/&gt;
      &lt;appender name=&quot;SPECIAL_FILE&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%date{yyyy-MM-dd HH:mm:ss.SSS} [%-10.10thread] %-5level %30.30logger{29}:%-4line %msg%n&lt;/pattern&gt;
              &lt;charset&gt;utf8&lt;/charset&gt;
          &lt;/encoder&gt;
          &lt;file&gt;logs/controller.log&lt;/file&gt;
          &lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.FixedWindowRollingPolicy&quot;&gt;
              &lt;fileNamePattern&gt;logs/controller-%i.log&lt;/fileNamePattern&gt;
          &lt;/rollingPolicy&gt;
          &lt;triggeringPolicy
                  class=&quot;ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy&quot;&gt;
              &lt;MaxFileSize&gt;10MB&lt;/MaxFileSize&gt;
          &lt;/triggeringPolicy&gt;
      &lt;/appender&gt;
  
      &lt;logger name=&quot;com.org.app.controller&quot; level=&quot;debug&quot; additivity=&quot;false&quot;&gt;
          &lt;appender-ref ref=&quot;SPECIAL_FILE&quot;/&gt;
      &lt;/logger&gt;
  
      &lt;root level=&quot;INFO&quot;&gt;
          &lt;appender-ref ref=&quot;FILE&quot;/&gt;
          &lt;appender-ref ref=&quot;CONSOLE&quot;/&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>My Service is configured like this</p>
  <pre><code>[Unit]
  Description=myapp
  
  [Service]
  User=appuser
  WorkingDirectory=/home/appuser 
  ExecStart=/usr/bin/java -Xmx256m -jar -Dspring.profiles.active=test /home/appuser/myapp.jar 
  SuccessExitStatus=143
  TimeoutStopSec=10
  Restart=on-failure
  RestartSec=10
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  <p>However, the logs are not generated when the service is started. Any ideas ??</p>
  <p>if i use the command in shell the logs get generated</p>
  <pre><code>/usr/bin/java -Xmx256m -jar -Dspring.profiles.active=test /home/appuser/myapp.jar 
  </code></pre>
  <p>I even tried adding the below the the service file however no luck.</p>
  <pre><code>StandardOutput=/home/appuser/logs/log.log
  StandardError=/home/appuser/logs/error.log
  </code></pre>