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 41281200B79 for ; Wed, 24 Aug 2016 05:28:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3F8BA160ABF; Wed, 24 Aug 2016 03:28:22 +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 86539160AAD for ; Wed, 24 Aug 2016 05:28:21 +0200 (CEST) Received: (qmail 98444 invoked by uid 500); 24 Aug 2016 03:28:20 -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 98431 invoked by uid 99); 24 Aug 2016 03:28:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Aug 2016 03:28:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 86BF32C014E for ; Wed, 24 Aug 2016 03:28:20 +0000 (UTC) Date: Wed, 24 Aug 2016 03:28:20 +0000 (UTC) From: "Gary Gregory (JIRA)" To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4J2-1539) Add Core API Configurator.shutdown(LoggerContext, long, TimeUnit) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 24 Aug 2016 03:28:22 -0000 [ https://issues.apache.org/jira/browse/LOG4J2-1539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15434126#comment-15434126 ] Gary Gregory commented on LOG4J2-1539: -------------------------------------- OK, good. I attached a patch for the first step in [LOG4J2-1547] which is for the {{LoggerContext}} to be saved as a weak reference in the {{AbstractConfiguration}}. Then it will be a smaller change to make various managers get access to the {{LoggerContext}} through its {{Configuration}}. Initially this will be for the {{FileAppender}} and {{RollingFileAppender}}. I'll apply the patch tomorrow unless I hear that it is a catastrophy and I can move on to the next step. > Add Core API Configurator.shutdown(LoggerContext, long, TimeUnit) > ----------------------------------------------------------------- > > Key: LOG4J2-1539 > URL: https://issues.apache.org/jira/browse/LOG4J2-1539 > Project: Log4j 2 > Issue Type: New Feature > Components: Core > Reporter: Gary Gregory > Fix For: 2.7 > > Attachments: logging-log4j2.patch > > > Add Core API Configurator.shutdown(LoggerContext, long, TimeUnit): > {code:java} > /** > * Blocks until all Log4j tasks have completed execution after a shutdown request, or the timeout occurs, or the > * current thread is interrupted, whichever happens first. > *

> * Log4j can start threads to perform certain actions like file rollovers, calling this method with a timeout will > * block until the rollover thread is done. > *

> * > * @param ctx > * the logger context to shut down, may be null. > * @param timeout > * the maximum time to wait > * @param timeUnit > * the time unit of the timeout argument > * @return {@code true} if the logger context terminated and {@code false} if the timeout elapsed before > * termination. > */ > public static boolean shutdown(final LoggerContext ctx, final long timeout, final TimeUnit timeUnit) > {code} > Clarify the existing Javadoc for {{shutdown(LoggerContext}} as: > {code:java} > /** > * Shuts down the given logger context. This request does not wait for Log4j tasks to complete. > *

> * Log4j starts threads to perform certain actions like file rollovers; calling this method will not wait until the > * rollover thread is done. When this method returns, these tasks' status are undefined, the tasks may be done or > * not. > *

> * > * @param ctx > * the logger context to shut down, may be null. > */ > public static void shutdown(final LoggerContext ctx) > {code} > This also eliminates all intermittent failures in rollover unit tests like {{org.apache.logging.log4j.core.appender.rolling.RollingAppenderCronTest.testAppender}}. -- 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