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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-rc1
    • Fix Version/s: 2.0
    • Component/s: Documentation
    • Labels:
      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

            People

            • Assignee:
              remkop@yahoo.com Remko Popma
              Reporter:
              agattik Alexandre Gattiker
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: