Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 38B98200BEE for ; Sat, 31 Dec 2016 19:28:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 373C4160B28; Sat, 31 Dec 2016 18:28:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7F456160B15 for ; Sat, 31 Dec 2016 19:27:59 +0100 (CET) Received: (qmail 7727 invoked by uid 500); 31 Dec 2016 18:27:58 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 7716 invoked by uid 99); 31 Dec 2016 18:27:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Dec 2016 18:27:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 79B082C1F54 for ; Sat, 31 Dec 2016 18:27:58 +0000 (UTC) Date: Sat, 31 Dec 2016 18:27:58 +0000 (UTC) From: "Georg Friedrich (JIRA)" To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4J2-1653) CronTriggeringPolicy uses wrong naming and produces NPE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 31 Dec 2016 18:28:00 -0000 [ https://issues.apache.org/jira/browse/LOG4J2-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15789853#comment-15789853 ] Georg Friedrich commented on LOG4J2-1653: ----------------------------------------- [~garydgregory] can you give any update on this? You've already fixed LOG4J2-1474 but there are still several other flaws. Maybe you can check my patch. Please see LOG4J2-1649 too. Thanks in advance. > CronTriggeringPolicy uses wrong naming and produces NPE > ------------------------------------------------------- > > Key: LOG4J2-1653 > URL: https://issues.apache.org/jira/browse/LOG4J2-1653 > Project: Log4j 2 > Issue Type: Bug > Affects Versions: 2.7 > Reporter: Georg Friedrich > Priority: Critical > Attachments: ConfigurationScheduler.patch, CronTriggeringPolicy.patch > > > After having worked on LOG4J2-1649 I found another serious issue in combination with the CronTriggeringPolicy. > The policy has some very weird behaviour when it comes to naming rolled over files and also creates a NPE on specific configurations. > The following is broken: > * when using "evaluateOnStartup" a NPE is the result of an immediate rollover > * when no rollover is happing at startup the first rollover produces a file that uses the time of the rollover (e.g. rollover is happening at midnight 2010-05-05 producing a rolled over file named log-2010-05-05) > * but it becomes worse: all files after the first rollover are named using a date of the "previous rollover date minus a second" - when using the previous example this results in: > ** first rollover happening at midnight 2010-05-05, resulting in file log-2010-05-05 > ** next rollover happening at 2010-05-06, resulting in file log-2010-05-04 > ** next rollover happening at 2010-05-07, resulting in file log-2010-05-05 again (!) so the previously saved file gets removed! > I would expect the file to be named after the content it contains. E.g. a file rolled over at 2010-05-05 should be named log-2010-05-04 as it contains all the data of the 2010-05-04. > So I decided to write a patch for those problems too (again the sources of Log4J2 2.7 were used). Unfortunately I needed a method to calculate the last cron date. The CronExpression class has such a method ("getTimeBefore") but nobody implemented this one since years. > The only quick solution I found: I used another 3rd party library to fix this called cronutils. The solution I wrote uses the latest version of this library which now only supports Java 8. > My guess is that you don't want Log4J2 to only support Java 8 - if this is the case you will have to use a different library/version or whatever to be able to calculate the last cron date. > This patch should also fix the following bugs: LOG4J2-1640, LOG4J2-1621, LOG4J2-1487, LOG4J2-1474 (and maybe even more - I didn't feel like searching the whole Jira ;-) ) -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org