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

Support JUL ApiLogger::setLevel

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.17.2
    • 2.18.0
    • JUL adapter
    • None

    Description

      The current implementation of ApiLogger::setLevel is to throw an UnsupportedOperation Exception.

      It turns out that Gradle's internal logging tries to call this method under some configurations, and it cannot deal gracefully with that Exception, so the build fails.

      mattsicker I was wondering if there is any reason why the implementation could not be like this:

      @Override
      public void setLevel(final Level newLevel) throws SecurityException {
          doSetLevel(newLevel);
          Configurator.setLevel(logger, LevelTranslator.toLevel(newLevel));
      }
      

      I will try this in a test project.

      (5 minutes later...) Looking at LOG4J2-1110, I understand that this can be done in CoreLogger but not in ApiLogger.

      Still, would it be possible to silently ignore this call to setLevel, rather than throwing an UnsupportedOperationException?

      Attachments

        Issue Links

          Activity

            People

              rpopma Remko Popma
              rpopma Remko Popma
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: