All,
I’m trying to work on an upgrade path for our 3.5.2 environment. I initially decided to go with 4.2.7, but after having a great deal of troubles, I decided I would go ahead and make the jump to the 5.x version since it is the newest. I selected all of the dependencies I thought I would need and put this into my pom.xml and the war file builds with no issues.
OS information:
RHEL 7.3
JAVA: Oracle JDK 1.8.0_121
Tomcat: 8.0.41
My tomcat installation at this point is pretty vanilla. I haven’t added any SSL configurations, as I just wanted to make sure that the app would deploy (with a few errors since I haven’t completely configured the /etc/cas/config/cas.properties file yet). But upon deployment, I get a great deal of logging errors. I get the following error for every log file that is included in the log4j2.xml file:
2017-01-27 11:45:52,053 localhost-startStop-1 ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.reflect.InvocationTargetException
2017-01-27 11:45:52,056 localhost-startStop-1 ERROR Unable to create file perfStats.log java.io.IOException: Permission denied
I modified my log4j2.xml to the following. I am able to get the cas.log file to write to the /usr/share/tomcat/logs directory and append the date. But I am still receiving permission denied error messages, even though the tomcat user is running the service and owns all files and directories under the tomcat directory. I’ve even gone as far as to chmod 777 the entire directory to see if that would allow the files to write and it does not. The only thing that I noticed was that at one point in the tomcat logs, I saw that the logs were trying to be rotated out to the root of the file system on the server.
The only thing I have changed in the /etc/cas/config/log4j2.xml is the filename and filePattern properties to use an absolute path.
<RollingFile name="file" fileName="/usr/share/tomcat/logs/cas.log" append="true"
filePattern="/usr/share/tomcat/logs/cas-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%d %p [%c] - <%m>%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
<RollingFile name="auditlogfile" fileName="/usr/share/tomcat/logs/cas_audit.log" append="true"
filePattern="/usr/share/tomcat/logs/cas_audit-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%d %p [%c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
<RollingFile name="perfFileAppender" fileName="/usr/share/tomcat/logs/perfStats.log" append="true"
filePattern="/usr/share/tomcat/logs/perfStats-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%m%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
I’ve been trying to figure out why this has been failing for quite a while now and I feel like I am nowhere closer than when I started. Any help would be greatly appreciated.
Ben Branch
UNIX/Linux Administrator
University of Central Oklahoma
ITIL Foundation v3, Network+, RHCE
100 N. University Drive, Box 122
Edmond, OK 73034
D: 405.974.2649 | M: 405.550.6804 | bbranch@uco.edu | www.uco.edu
“I am wiser than this man, for neither of us appears to know anything great and good; but he fancies he knows something, although he knows nothing; whereas I, as I do not know anything, so I do not fancy I do. In this trifling particular, then, I appear to be wiser than he, because I do not fancy I know what I do not know.” - Socrates
WorkingDirectory=/whatever/tomcat/logs