Question

On starting Tomcat 7 i have following exception:

openFile(/home/myuser/tomcat7/logs/myapp/myapp.log,true) call failed. java.io.FileNotFoundException: /home/myuser/tomcat7/logs/myapp/myapp.log (Permission denied)
        at java.io.FileNotFoundException: /home/myuser/tomcat7/logs/myapp/myapp.log (Permission denied)

My configuration in logback.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="fileAppender" class="ch.qos.logback.core.FileAppender">
<file>/home/myuser/tomcat7/logs/myapp/myapp.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>myapp.%d{yyyy-MM-dd}.log</fileNamePattern>
            
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
        
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{40} - %msg%n</pattern>
</encoder>
</appender>

<logger name="ma.package"   level="DEBUG" />

<root level="INFO">
<appender-ref ref="fileAppender" />
</root>
</configuration>

I have tried xreate the file manually and us chmod 666, nothing will work. I hope every one here have an solution.

Was it helpful?

Solution

Ok, the solution was to set up tomcat group and user to this folder

chown tomcat7:tomcat7 /home/myUser/tomcat7/logs
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top