Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3126

file permissions doesn't work on RollingRandomAccessFile appender

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.11.1
    • None
    • Appenders
    • None

    Description

      I'm using a RollingRandomAccessFile appender in my log4j2 config, I want the log file has permission 750(rwxr-x---), but only the first log file(the one that gets created when application starts up) has permission 750, all the new log file after rolling over still has a default permission, as you can see in the image below, server.log.1 has permission 750, which is the very first server.log that gets renamed to server.log.1, all the other files have a default permission.

      my configuration for the appender is below:

       

      <RollingRandomAccessFile name="testlog"
         fileName="${LOG_DIR}/server.log" filePattern="${LOG_DIR}/server.log.%i"
                filePermissions="rwxr-x---"
         append="true" >
         <PatternLayout>
            <Pattern>some random pattern that I don't want to show here</Pattern>
         </PatternLayout>
         <Policies>
            <SizeBasedTriggeringPolicy size="10 KB" />
         </Policies>
         <DefaultRolloverStrategy max="7"/>
      </RollingRandomAccessFile>
      
      

      It looks like log4j2 sets permission correctly on startup, but doesn't set permission when rolling over log files, am I using the correct configuration or is this a bug? thanks.

       

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            devilevga2015 tony
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: