You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Suman (Jira)" <ji...@apache.org> on 2021/07/14 10:57:00 UTC
[jira] [Created] (LOG4J2-3124) log file name with variables not
resolving for the first time
Suman created LOG4J2-3124:
-----------------------------
Summary: log file name with variables not resolving for the first time
Key: LOG4J2-3124
URL: https://issues.apache.org/jira/browse/LOG4J2-3124
Project: Log4j 2
Issue Type: Bug
Components: Core
Affects Versions: 2.14.0
Reporter: Suman
Attachments: log4j2.xml, log_files.PNG, server.log, web.xml
Hi Team,
We are using log4j2 as logging utility in our application , Below is the file appender we are using for populating logs in log file
<RollingFile name="FILE" fileName="${sys:jboss.server.log.dir}\\server.log.${centricity.log.id}CentricityPractice.log" filePattern="${centricity.log.directory}server.log.${centricity.log.id}CentricityPractice.log"> <PatternLayout pattern="%d\{ISO8601} %-5p (%t %X\{RequestId} %X\{CallerId}) [%c\{1}] %m%n" /> <Policies> <SizeBasedTriggeringPolicy size="5000KB" />
</Policies> <DefaultRolloverStrategy max="5" />
</RollingFile>
Here we are using a variable ${centricity.log.id} for creating log file , and we are setting this variable during server startup in listener(com.gehcit.cp.ws.infrastructure.configuration.*ConfigurationLoaderListener*) which is defined in web.xml file. When we do any changes in log4j2.xml and published these variables are not resolving at very first time , but after restarting its working as expected , meaning log files are creating in expected location with correct file names . And this is same for other appenders also , can you help us to fix this problem ? Very first time variables are not resolving the log4j2.xml variables used for log file creation but after restarting jboss its starts working
PFA for log4j2.xml , web.xml(Where listener is defined to set variables) and ConfigurationLoaderListener.java(Java listener) , screen shot for log file creations
!log_files.PNG!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)