{"action":"opened","issue":{"url":"https://api.github.com/repos/chef-cookbooks/tomcat/issues/284","repository_url":"https://api.github.com/repos/chef-cookbooks/tomcat","labels_url":"https://api.github.com/repos/chef-cookbooks/tomcat/issues/284/labels{/name}","comments_url":"https://api.github.com/repos/chef-cookbooks/tomcat/issues/284/comments","events_url":"https://api.github.com/repos/chef-cookbooks/tomcat/issues/284/events","html_url":"https://github.com/chef-cookbooks/tomcat/issues/284","id":201882379,"number":284,"title":"Web Application Log files fail to write","user":{"login":"malibu11","id":782057,"avatar_url":"https://avatars.githubusercontent.com/u/782057?v=3","gravatar_id":"","url":"https://api.github.com/users/malibu11","html_url":"https://github.com/malibu11","followers_url":"https://api.github.com/users/malibu11/followers","following_url":"https://api.github.com/users/malibu11/following{/other_user}","gists_url":"https://api.github.com/users/malibu11/gists{/gist_id}","starred_url":"https://api.github.com/users/malibu11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malibu11/subscriptions","organizations_url":"https://api.github.com/users/malibu11/orgs","repos_url":"https://api.github.com/users/malibu11/repos","events_url":"https://api.github.com/users/malibu11/events{/privacy}","received_events_url":"https://api.github.com/users/malibu11/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-19T14:55:44Z","updated_at":"2017-01-19T14:55:44Z","closed_at":null,"body":"### Cookbook version\r\n2.3.4\r\n\r\n### Chef-client version\r\nChef Development Kit Version: 0.16.28\r\nchef-client version: 12.12.15\r\n\r\n### Platform Details\r\nCentOS Linux release 7.2.1511 (Core) \r\n\r\n### Scenario:\r\nIf a web application doesn't specify an absolute path for a log file, log4j will write to the current directory. With CentOS 7, log4j is attempting to write the file to the root folder and does not have permission.\r\n\r\n### Steps to Reproduce:\r\nOn CentOS 7, Web application with log4j configuration similar to:\r\nlog4j.appender.LOGFILE.File=web_app.log\r\n\r\n### Expected Result:\r\nThe web_app.log file is written to the tomcat install log path\r\n\r\n### Actual Result:\r\nThe /var/log/messages file shows an error similar to:\r\n\r\nJan 18 14:02:07 localhost catalina.sh: log4j:ERROR setFile(null,true) call failed.\r\nJan 18 14:02:07 localhost catalina.sh: java.io.FileNotFoundException: web_app.log (Permission denied)\r\nJan 18 14:02:07 localhost catalina.sh: at java.io.FileOutputStream.open0(Native Method)\r\nJan 18 14:02:07 localhost catalina.sh: at java.io.FileOutputStream.open(FileOutputStream.java:270)\r\nJan 18 14:02:07 localhost catalina.sh: at java.io.FileOutputStream.<init>(FileOutputStream.java:213)\r\nJan 18 14:02:07 localhost catalina.sh: at java.io.FileOutputStream.<init>(FileOutputStream.java:133)\r\nJan 18 14:02:07 localhost catalina.sh: at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)\r\nJan 18 14:02:07 localhost catalina.sh: at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)\r\n...\r\n\r\n### Suggested Solution:\r\nAdd WorkingDirectory to  templates/init_systemd.erb as follows:\r\n\r\n# Systemd unit file for tomcat_<%= @instance %>\r\n\r\n[Unit]\r\nDescription=<%= @instance %> Apache Tomcat Application\r\nAfter=syslog.target network.target\r\n\r\n[Service]\r\nType=simple\r\n\r\n<% @env_vars.each do |h| -%>\r\n  <% h.each_pair do |k,v| -%>\r\nEnvironment=\"<%= k -%>=<%= v %>\"\r\n  <% end -%>\r\n<% end -%>\r\n\r\nWorkingDirectory=<%= @install_path %>/logs\r\n\r\nExecStart=<%= @install_path %>/bin/catalina.sh run\r\nExecStop=<%= @install_path %>/bin/catalina.sh stop\r\nRestart=on-failure\r\nRestartSec=2\r\n\r\nUser=<%= @user %>\r\nGroup=<%= @group %>\r\n\r\n[Install]\r\nWantedBy=multi-user.target"}}
{"actor":{"display_login":"malibu11"}}