Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1539

Add Core API Configurator.shutdown(LoggerContext, long, TimeUnit)

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7
    • Component/s: Core
    • Labels:
      None

      Description

      Add Core API Configurator.shutdown(LoggerContext, long, TimeUnit):

          /**
           * 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.
           * <p>
           * 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.
           * </p>
           * 
           * @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)
      

      Clarify the existing Javadoc for shutdown(LoggerContext as:

          /**
           * Shuts down the given logger context. This request does not wait for Log4j tasks to complete.
           * <p>
           * 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.
           * </p>
           * 
           * @param ctx
           *            the logger context to shut down, may be null.
           */
          public static void shutdown(final LoggerContext ctx)
      

      This also eliminates all intermittent failures in rollover unit tests like org.apache.logging.log4j.core.appender.rolling.RollingAppenderCronTest.testAppender.

        Attachments

        Issue Links

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

            • Assignee:
              Unassigned
              Reporter:
              ggregory Gary D. Gregory

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment