title: In Log4j2, how to avoid logging messages that contain a certain text?
body: <p>How can I filter out <strong>Log4j2</strong> messages according to their message content?</p>
  
  <p>For example, I don't want to log Hibernate messages that contain the text: <code>HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead</code>. Of course, I can disable all Hibernate deprecation warnings, like this:</p>
  
  <pre><code>&lt;Logger name="org.hibernate.orm.deprecation" additivity="false" level="ERROR"&gt;
      …
  &lt;/Logger&gt;
  </code></pre>
  
  <p>But then I will get no deprecation warnings at all, and they are usually useful. I want to remove just that one (because there is nothing I can do to fix it, and they are issued by the thousands). Please note this is a Log4j2 question, not a Hibernate question.</p>