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

Pattern to drop first N package parts

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

    Details

    • Type: Wish
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 2.0-rc1
    • Fix Version/s: None
    • Component/s: Layouts
    • Labels:
      None

      Description

      Currently you can have a pattern that will print out the last N parts of you package. So if my package was uk.co.ltheobald.foo.bar, then using %logger{2} will print foo.bar. But when I have a number of different package levels, this becomes less useful (in my opinion).

      What I'd find more useful is the inverse where I can ditch the first N parts. Something like %logger{-3} for example. That way I'd end up with:

      uk.co.ltheobald.Main logging as Main
      uk.co.ltheobald.foo.MyClass logging as foo.MyClass
      uk.co.ltheobald.foo.bar.MyOtherClass logging as foo.bar.MyOtherClass

      Removing from the start of the logger name allows me to consistently trim off package names that I know are always the same. I'll see if I can produce a code example for this if I get time but I wanted to log it in the meanwhile.

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lee@openobjects.com Lee Theobald

              Dates

              • Created:
                Updated:

                Issue deployment