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

Update docs to clarify how to use formatter logger and standard logger together

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

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0-rc1
    • 2.0
    • Documentation
    • None

    Description

      public class Example {
      
      	private final static Logger FORMATTER_LOGGER = LogManager.getFormatterLogger(Example.class);
      
      	private final static Logger LOGGER = LogManager.getLogger(Example.class);
      
      	public static void main(String[] args) {
      		LOGGER.log(ERROR, "{} happened", "Something");
      		FORMATTER_LOGGER.log(ERROR, "%s happened", "Something");
      	}
      }
      
      13:40:35.401 [main] ERROR com.example.Example - {} happened
      13:40:35.404 [main] ERROR com.example.Example - Something happened
      

      After inverting the two constant declarations:

      13:41:13.730 [main] ERROR com.example.Example - Something happened
      13:41:13.732 [main] ERROR com.example.Example - %s happened
      

      Attachments

        Activity

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

          People

            rpopma Remko Popma
            agattik Alexandre Gattiker
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment