[ 
https://issues.apache.org/jira/browse/LOG4J2-3018?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rambabu Bikumandla updated LOG4J2-3018:
---------------------------------------
    Description: 
Hi Team,

Am migrating my project from log4j1.x to log4j2.11.2 version, while migration 
am seeing below issue could you please provide solution on it.

Issue: log files are not roll out every day midnight with new file name, it 
still writing it to old logs for some hours then switching to new logs.

Below my log4j2.xml config.

<Routing name="DEBUG">
 <Routes pattern="$${ctx:ServiceName}">
 <Route key="ConsuerManager">
 <RollingFile name="Rolling-${ctx:ServiceName}" 
 fileName="/app/log/Consumer_${date:yyyy-MM-dd}.log" 
 filePattern="/app/log/Consumer_%d\{yyyy-MM-dd}.log" append="true">
 <LevelRangeFilter minLevel="INFO" maxLevel="DEBUG" onMatch="ACCEPT" 
onMismatch="DENY" />
 <PatternLayout pattern="${LOG_PATTERN}" />
 <Policies> 
 <TimeBasedTriggeringPo licy interval="1" modulate="true" />
 </Policies>
 </RollingFile>
 </Route>
 <Route key="AppProvider">
 <RollingFile name="Rolling-${ctx:ServiceName}" 
 fileName="/app/log/Provider_${date:yyyy-MM-dd}.log"
 filePattern="/app/log/Provider_%d\{yyyy-MM-dd}.log" append="true">
 <LevelRangeFilter minLevel="INFO" maxLevel="DEBUG" onMatch="ACCEPT" 
onMismatch="DENY" />
 <PatternLayout pattern="${LOG_PATTERN}" />
 <Policies>
 <TimeBasedTriggeringPolicy interval="1" modulate="true" />
 </Policies></RollingFile></Route>
 </Routes>
 </Routing>

*Sample Logs: consumer_2021-02-08.log*

[Feb/08/21 18:18:37] INFO com.app.apptest.Database.DbRequest - approval status 
of the myno: 125478412 Is ::W
 [Feb/08/21 18:18:37] INFO com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
 [Feb/08/21 18:18:37] INFO com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
 [Feb/08/21 18:18:37] INFO com.bi.myapp.consumer.utils.ConsumerHelper - 
conditional status for the myno ::4857154 is :: false
 [Feb/08/21 18:18:37] INFO com.app.apptest.Database.Database - Database 
initialized
 [Feb/08/21 18:18:37] INFO com.app.apptest.MyManagement.Database - Database 
initialized
 [Feb/08/21 18:18:38] INFO com.app.apptest.Database.DbTtion - mynoId :123456 
mynoID :45678 
 [Feb/08/21 18:18:38] INFO com.bi.persistent.process.DBProcess - db is 
::org.apache.db.oracle.DBCommandOracle@516c36a0
 [Feb/08/21 18:18:38] INFO com.bi.persistent.process.DBProcess - db is 
::org.apache.db.oracle.DBCommandOracle@4ee951e2
 [Feb/08/21 18:18:38] INFO com.bi.myapp.restclients.CircuitImpactClient - 
constructor: Using environment Test to get URL info
 ..
 ..
 [Feb/09/21 12:37:43] INFO com.bi.myapp.util.Client - connectToId: Trying to 
connect to mail server; 
 [Feb/09/21 12:37:44] INFO com.bi.myapp.util.Client - connectToId: Successfully 
connected to .
 [Feb/09/21 12:37:45] INFO com.bi.myapp.util.Client - readMails: There are 0 
messages to be processed
 [Feb/09/21 12:37:45] INFO com.bi.myapp.util.Client - readMails: Number of 
unread messages still in the
 [Feb/09/21 12:37:45] INFO com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
- updateLock invoked at 12:37:45 PM GMT took 3 milliseconds to execute.
 [Feb/09/21 12:37:45] INFO com.bi.myapp.scheduler.EmailReaderScheduler - 
 ~
 "consumer_2021-02-08.log" [readonly] 6327556L, 273633483C

  was:
Hi Team,

Am migrating my project from log4j1.x to log4j2.11.2 version, while migration 
am seeing below issue could you please provide solution on it.

Issue: log files are not roll out every day midnight with new file name, it 
still writing it to old logs for some hours then switching to new logs.

Below my log4j2.xml config.

<Routing name="DEBUG">
 <Routes pattern="$${ctx:ServiceName}">
 <Route key="ConsuerManager">
 <RollingFile name="Rolling-${ctx:ServiceName}" 
 fileName="/app/log/Consumer_${date:yyyy-MM-dd}.log" 
 filePattern="/app/log/Consumer_%d\{yyyy-MM-dd}.log" append="true">
 <LevelRangeFilter minLevel="INFO" maxLevel="DEBUG" onMatch="ACCEPT" 
onMismatch="DENY" />
 <PatternLayout pattern="${LOG_PATTERN}" />
 <Policies> 
 <TimeBasedTriggeringPo licy interval="1" modulate="true" />
 </Policies>
 </RollingFile>
 </Route>
 <Route key="AppProvider">
 <RollingFile name="Rolling-${ctx:ServiceName}" 
 fileName="/app/log/Provider_${date:yyyy-MM-dd}.log"
 filePattern="/app/log/Provider_%d\{yyyy-MM-dd}.log" append="true">
 <LevelRangeFilter minLevel="INFO" maxLevel="DEBUG" onMatch="ACCEPT" 
onMismatch="DENY" />
 <PatternLayout pattern="${LOG_PATTERN}" />
 <Policies>
 <TimeBasedTriggeringPolicy interval="1" modulate="true" />
 </Policies></RollingFile></Route>
 </Routes>
 </Routing>

*Sample Logs: consumer_2021-02-08.log*

[Feb/08/21 18:18:37] INFO com.app.apptest.Database.DbRequest - approval status 
of the request 125478412 Is ::W
 [Feb/08/21 18:18:37] INFO com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
 [Feb/08/21 18:18:37] INFO com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
 [Feb/08/21 18:18:37] INFO com.bi.myapp.CustomerManagement.utils.CustomerHelper 
- conditional status for the reqid ::4857154 is :: false
 [Feb/08/21 18:18:37] INFO com.app.apptest.Database.Database - Database 
initialized
 [Feb/08/21 18:18:37] INFO com.app.apptest.MyManagement.Database - Database 
initialized
 [Feb/08/21 18:18:38] INFO com.app.apptest.Database.DbTransaction - Request Id 
:123456 Transaction ID :45678 itemId : 223311
 [Feb/08/21 18:18:38] INFO com.bi.persistent.process.DBReadProcess - db is 
::org.apache.empire.db.oracle.DBCommandOracle@516c36a0
 [Feb/08/21 18:18:38] INFO com.bi.persistent.process.DBReadProcess - db is 
::org.apache.empire.db.oracle.DBCommandOracle@4ee951e2
 [Feb/08/21 18:18:38] INFO com.bi.myapp.restclients.CircuitImpactClient - 
constructor: Using environment Test to get URL info
 ..
 ..
 [Feb/09/21 12:37:43] INFO com.bi.myapp.util.Client - connectToId: Trying to 
connect to mail server; 
 [Feb/09/21 12:37:44] INFO com.bi.myapp.util.Client - connectToId: Successfully 
connected to .
 [Feb/09/21 12:37:45] INFO com.bi.myapp.util.Client - readMails: There are 0 
messages to be processed
 [Feb/09/21 12:37:45] INFO com.bi.myapp.util.Client - readMails: Number of 
unread messages still in the INBOX is 0
 [Feb/09/21 12:37:45] INFO com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
- updateLock invoked at 12:37:45 PM GMT took 3 milliseconds to execute.
 [Feb/09/21 12:37:45] INFO com.bi.myapp.scheduler.EmailReaderScheduler - 
 ~
 "consumer_2021-02-08.log" [readonly] 6327556L, 273633483C


> Rollover log file at midnight not working
> -----------------------------------------
>
>                 Key: LOG4J2-3018
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3018
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Rambabu Bikumandla
>            Priority: Critical
>
> Hi Team,
> Am migrating my project from log4j1.x to log4j2.11.2 version, while migration 
> am seeing below issue could you please provide solution on it.
> Issue: log files are not roll out every day midnight with new file name, it 
> still writing it to old logs for some hours then switching to new logs.
> Below my log4j2.xml config.
> <Routing name="DEBUG">
>  <Routes pattern="$${ctx:ServiceName}">
>  <Route key="ConsuerManager">
>  <RollingFile name="Rolling-${ctx:ServiceName}" 
>  fileName="/app/log/Consumer_${date:yyyy-MM-dd}.log" 
>  filePattern="/app/log/Consumer_%d\{yyyy-MM-dd}.log" append="true">
>  <LevelRangeFilter minLevel="INFO" maxLevel="DEBUG" onMatch="ACCEPT" 
> onMismatch="DENY" />
>  <PatternLayout pattern="${LOG_PATTERN}" />
>  <Policies> 
>  <TimeBasedTriggeringPo licy interval="1" modulate="true" />
>  </Policies>
>  </RollingFile>
>  </Route>
>  <Route key="AppProvider">
>  <RollingFile name="Rolling-${ctx:ServiceName}" 
>  fileName="/app/log/Provider_${date:yyyy-MM-dd}.log"
>  filePattern="/app/log/Provider_%d\{yyyy-MM-dd}.log" append="true">
>  <LevelRangeFilter minLevel="INFO" maxLevel="DEBUG" onMatch="ACCEPT" 
> onMismatch="DENY" />
>  <PatternLayout pattern="${LOG_PATTERN}" />
>  <Policies>
>  <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>  </Policies></RollingFile></Route>
>  </Routes>
>  </Routing>
> *Sample Logs: consumer_2021-02-08.log*
> [Feb/08/21 18:18:37] INFO com.app.apptest.Database.DbRequest - approval 
> status of the myno: 125478412 Is ::W
>  [Feb/08/21 18:18:37] INFO 
> com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
>  [Feb/08/21 18:18:37] INFO 
> com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor 
>  [Feb/08/21 18:18:37] INFO com.bi.myapp.consumer.utils.ConsumerHelper - 
> conditional status for the myno ::4857154 is :: false
>  [Feb/08/21 18:18:37] INFO com.app.apptest.Database.Database - Database 
> initialized
>  [Feb/08/21 18:18:37] INFO com.app.apptest.MyManagement.Database - Database 
> initialized
>  [Feb/08/21 18:18:38] INFO com.app.apptest.Database.DbTtion - mynoId :123456 
> mynoID :45678 
>  [Feb/08/21 18:18:38] INFO com.bi.persistent.process.DBProcess - db is 
> ::org.apache.db.oracle.DBCommandOracle@516c36a0
>  [Feb/08/21 18:18:38] INFO com.bi.persistent.process.DBProcess - db is 
> ::org.apache.db.oracle.DBCommandOracle@4ee951e2
>  [Feb/08/21 18:18:38] INFO com.bi.myapp.restclients.CircuitImpactClient - 
> constructor: Using environment Test to get URL info
>  ..
>  ..
>  [Feb/09/21 12:37:43] INFO com.bi.myapp.util.Client - connectToId: Trying to 
> connect to mail server; 
>  [Feb/09/21 12:37:44] INFO com.bi.myapp.util.Client - connectToId: 
> Successfully connected to .
>  [Feb/09/21 12:37:45] INFO com.bi.myapp.util.Client - readMails: There are 0 
> messages to be processed
>  [Feb/09/21 12:37:45] INFO com.bi.myapp.util.Client - readMails: Number of 
> unread messages still in the
>  [Feb/09/21 12:37:45] INFO 
> com.myapp.servicecore.ejb.monitor.AppTestsEJBMonitor - updateLock invoked at 
> 12:37:45 PM GMT took 3 milliseconds to execute.
>  [Feb/09/21 12:37:45] INFO com.bi.myapp.scheduler.EmailReaderScheduler - 
>  ~
>  "consumer_2021-02-08.log" [readonly] 6327556L, 273633483C



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to