public void test3() {
        Pattern pat = Pattern.compile("LogFactory.getFactory\\(\\).getInstance\\(");
        String s = "Log log =  LogFactory.getFactory().getInstance(\"x\");";
        Matcher m = pat.matcher(s);
        assertTrue(m.find());
        String r = m.replaceAll("LoggerFactory.getLogger(");
        assertEquals("Log log =  LoggerFactory.getLogger(\"x\");", r);

        String nonMatching = "Log log = xxx;";
        pat.matcher(nonMatching);
        assertFalse(m.find());
    }
In this test we use a simple Pattern to replace the log instantiation
without influence on Log declaration.
slf4j-migrator/src/test/java/org/slf4j/migrator/AternativeApproach.java