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
- 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/e081da1e-45f1-4bd2-b59d-2a568d251f9d%40apereo.org.

Reply via email to