CAS 5.0.2 and logging errors on initial deployment

1,065 views
Skip to first unread message

Ben Branch

unread,
Jan 27, 2017, 1:15:24 PM1/27/17
to cas-...@apereo.org

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] - &lt;%m&gt;%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

 

Jozef

unread,
Jan 31, 2017, 10:42:24 AM1/31/17
to CAS Community
Are you sure, that you are editing the correct log4j2.xml? Do you have
defined location in logging.config property?
It seems to me, that CAS is loading the default log4j2.xml, e.g. without paths and trying to create them in current directory. 

Dodo

CanaryJudge

unread,
Mar 24, 2017, 1:34:29 PM3/24/17
to CAS Community
Make sure your startup script places you in the correct directory when starting the app. 
For example I had to set:

WorkingDirectory=/whatever/tomcat/logs

https://www.freedesktop.org/software/systemd/man/systemd.exec.html

when using systemd to start tomcat. 

The cas app has a log4j2.xml configuration file in:  .../cas/WEB-INF/classes/

When the app starts up it configures log4j2 using that file first.
Reply all
Reply to author
Forward
0 new messages