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

Unable to create custom logging level using log4j 2 Bridge API

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.17.1
    • 2.18.0
    • Log4j 1.2 bridge
    • None
    • Using log4j 2 bridge API: log4j-1.2-api-2.17.1.jar

    Description

      Unable to create custom logging level using log4j 2 Bridge API

      Following did not create a custom logging level

      public static final int FINE_INT = 13000;

      public static final Level FINE = new Level(FINE_INT, "FINE", 7); 

       

      Using FINE logging level is considered to be DEBUG level by default while printing it

      Adding log:

      log.log(Level.FINE,"PRINT: Level.FINE log");

       

      Expected log printed:

      2022-02-25 15:50:09,208 Main[6788] :main: example.com.Test FINE - PRINT: Level.FINE log 

       

      Actual log printed:

      2022-02-25 15:50:09,208 Main[6788] :main: example.com.Test DEBUG - PRINT: Level.FINE log 

      Attachments

        1. DemoCustom.zip
          2.08 MB
          Tukesh
        2. Level.java
          4 kB
          Ragini Gawande
        3. log4j.properties
          1 kB
          Ragini Gawande

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            pkarwasz Piotr Karwasz
            ragini Ragini Gawande
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment