I have a java application running in a docker container. I can't change the program but I can change the log4j2.properties file. I want to add a rolling file appender but when I do it I get this error:
ERROR An exception occurred processing Appender file_appender java.security.AccessControlException: access denied ("java.io.FilePermission" "shared_logs" "read")
Then I gave all permissions to my shared_logs folder
chmod 777 shared_logs
But the error is still there. This is how I added the the appender:
appender.fa.type = RollingFile
appender.fa.name = file_appender
appender.fa.fileName = shared_logs/elastic.log
appender.fa.filePattern = shared_logs/elastic-%d{yyyy-dd-MM}-%i.log.gz
appender.fa.layout.type = PatternLayout
appender.fa.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
appender.fa.policies.type = Policies
appender.fa.policies.time.type = TimeBasedTriggeringPolicy
appender.fa.policies.size.type = SizeBasedTriggeringPolicy
appender.fa.policies.size.size = 500
appender.fa.strategy.type = DefaultRolloverStrategy
appender.fa.strategy.max = 5
"fa" stands for fileappender