Hi Travis,

Thank you for that information. I thought I was overriding the log4j.xml files 
by putting them in etc/cas/config for each overlay but I just noticed I’m not. 
The reason the cas log4j works for me without permission error is because it 
sets baseDir to /etc/cas/logs. 
(https://github.com/apereo/cas/blob/master/webapp/resources/log4j2.xml)
The cas-management doesn’t set base-dir 
https://github.com/apereo/cas-management/blob/master/webapp-mgmt/cas-management-webapp/src/main/resources/log4j2.xml

Sorry I think this is a basic question, but with the overlay how do I override 
specific files in the targets maven builds? I tried creating the path and file 
in my build.sh directory but that didn’t work.

Thank you,

Jeremiah

From: [email protected] [mailto:[email protected]] On Behalf Of Travis 
Schmidt
Sent: Wednesday, February 7, 2018 3:04 PM
To: [email protected]
Subject: Re: [cas-user] cas-management 5.x cas-management.log 
java.io.IOException: Permission denied

Setting cas.log.dir in management.properties does not override System 
properties.  At least not that I was able to figure out.  So passing 
-Dcas.log.dir=/some/dir/ to your startup script should sub ${sys:cas.log.dir} 
correctly in your log42j.xml.  I also think that setting a default in the .xml 
file to be overridden by sys property is not achievable.  If you just want to 
set the log dir in property file in the xml, then just use ${cas.log.dir} and 
drop the sys: prefix.

More on this can be found here:

https://logging.apache.org/log4j/2.x/manual/configuration.html<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flogging.apache.org%2Flog4j%2F2.x%2Fmanual%2Fconfiguration.html&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=Qk7lhSBvVPGUoYaTb7meutHScsUGSttLeUlsIso8VDQ%3D&reserved=0>

Under the section Property Substitution


On Wed, Feb 7, 2018 at 10:08 AM Jeremiah Schilens 
<[email protected]<mailto:[email protected]>> wrote:
Hello,

I'm working on the cas-management-overlay for 5.x and it doesn't seem to be 
honoring the settings in the log4j2-management.xml. In my management.properties 
I have:

cas.log.dir=/u01/app/tomcat/logs/
logging.config=file:///etc/cas/config/log4j2-management.xml

and in the log4j2-management.xml file I have
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Specify the refresh internal in seconds. -->
<Configuration monitorInterval="60" packages="org.apereo.cas.logging">
    <Properties>
        <!--
        Default log directory is the current directory but that can be 
overridden with -Dcas.log.dir=<logdir>
        Or you can change this property to a new default
        -->
        <Property name="cas.log.dir" >/not/the/patht/logs/</Property>
        <!-- To see more CAS specific logging, adjust this property to info or 
debug or run server with -Dcas.log.leve=debug -->
        <Property name="cas.log.level" >info</Property>
    </Properties>
    <Appenders>
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d %p [%c] - &lt;%m&gt;%n"/>
        </Console>
        <RollingFile name="cas-management" 
fileName="${sys:cas.log.dir}/cas-management.log" append="true"
                     
filePattern="${sys:cas.log.dir}/cas-management-%d{yyyy-MM-dd-HH}-%i.log.gz">
            <PatternLayout pattern="%d %p [%c] - %m%n"/>
            <Policies>
                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="512 KB"/>
                <TimeBasedTriggeringPolicy />
            </Policies>
        </RollingFile>
    </Appenders>

But when the management app starts up it prints
localhost-startStop-1 ERROR Unable to create file cas-management.log 
java.io.IOException: Permission denied
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(File.java:1012)
        at 
org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:628)
        at 
org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:608)
        at 
org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113)
        at 
org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:115)
        at 
org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188)
...

Once the war deploys, if I look in  cas-management/WEB-INF/classes/log4j2.xml 
it has
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Specify the refresh internal in seconds. -->
<Configuration monitorInterval="15">
    <Appenders>
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%highlight{%d %p [%c] - &lt;%m&gt;}%n"/>
        </Console>
        <RollingFile name="cas-management" fileName="cas-management.log" 
append="true"
                     filePattern="cas-management-%d{yyyy-MM-dd-HH}-%i.log.gz">
            <PatternLayout pattern="%d %p [%c] - %m%n"/>
            <Policies>
                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="512 KB"/>
                <TimeBasedTriggeringPolicy />
            </Policies>
        </RollingFile>
    </Appenders>


If I look in the CAS app log4j.xml after deploy the file line is
 <RollingFile name="file" fileName="${baseDir}/cas.log" append="true"


Am I right in thinking this is a bug and the source for cas-management 
log4j.xml should be updated to have ${baseDir} added? Or am I missing something 
in my config?

Thank you,

Jeremiah

--
- Website: 
https://apereo.github.io/cas<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapereo.github.io%2Fcas&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=%2BFgfjzf9PN6DWyYwBH%2B19hbPEdH8luGqX1N0uNjBZK0%3D&reserved=0>
- Gitter Chatroom: 
https://gitter.im/apereo/cas<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitter.im%2Fapereo%2Fcas&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=Ld%2BDEuVtcC9w4NsHSphiGJrYyGrPwqccEltBfYeaa90%3D&reserved=0>
- List Guidelines: 
https://goo.gl/1VRrw7<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgoo.gl%2F1VRrw7&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=JBRTliunAf7YPhhQZhoLpBHc4grS1sCvKKRF1NeKyL0%3D&reserved=0>
- Contributions: 
https://goo.gl/mh7qDG<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgoo.gl%2Fmh7qDG&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=f6dUY7ly30eebdumqkoBTGucKEKxZmA%2F8BTtdZJn4y0%3D&reserved=0>
---
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/e081da1e-45f1-4bd2-b59d-2a568d251f9d%40apereo.org<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fa%2Fapereo.org%2Fd%2Fmsgid%2Fcas-user%2Fe081da1e-45f1-4bd2-b59d-2a568d251f9d%2540apereo.org%3Futm_medium%3Demail%26utm_source%3Dfooter&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=PnMYFtB2h4kX3Xr1uFJ5F6CJ0b%2BC7eeR96Y7dPZankA%3D&reserved=0>.
--
- Website: 
https://apereo.github.io/cas<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapereo.github.io%2Fcas&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=%2BFgfjzf9PN6DWyYwBH%2B19hbPEdH8luGqX1N0uNjBZK0%3D&reserved=0>
- Gitter Chatroom: 
https://gitter.im/apereo/cas<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitter.im%2Fapereo%2Fcas&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=Ld%2BDEuVtcC9w4NsHSphiGJrYyGrPwqccEltBfYeaa90%3D&reserved=0>
- List Guidelines: 
https://goo.gl/1VRrw7<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgoo.gl%2F1VRrw7&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=JBRTliunAf7YPhhQZhoLpBHc4grS1sCvKKRF1NeKyL0%3D&reserved=0>
- Contributions: 
https://goo.gl/mh7qDG<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgoo.gl%2Fmh7qDG&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=f6dUY7ly30eebdumqkoBTGucKEKxZmA%2F8BTtdZJn4y0%3D&reserved=0>
---
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAC_RtEbgi4E%3DXipCsUHy%2BFDH5kB--ECEJKdEQUn1FLvCXh9wSw%40mail.gmail.com<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fa%2Fapereo.org%2Fd%2Fmsgid%2Fcas-user%2FCAC_RtEbgi4E%253DXipCsUHy%252BFDH5kB--ECEJKdEQUn1FLvCXh9wSw%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=01%7C01%7Cjschilen%40kent.edu%7C060aa60189b74b181da108d56e65f951%7C51e321d7b5984fe6bee48ebebf844409%7C1&sdata=C0ftkuDV%2BOGmVX8deJPbYFbW2oB280Ba0ljRUdWFzfo%3D&reserved=0>.

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CY4PR08MB2615586CA5C6122D5908A0D8A8FC0%40CY4PR08MB2615.namprd08.prod.outlook.com.

Reply via email to