RpcLoggerFactory { public static org.slf4j.Logger getLogger(String name, String appname) { if (name == null || name.isEmpty()) { return null; } Map<String, String> properties = new HashMap<String, String>(); properties.put(APPNAME, appname == null ? "" : appname); SpaceId spaceId = new SpaceId(RPC_LOG_SPACE); if (appname != null) { spaceId.withTag(APPNAME, appname); } return LoggerSpaceManager.getLoggerBySpace(name, spaceId, properties); }  static org.slf4j.Logger getLogger(String name, String appname); static final String RPC_LOG_SPACE; }
@Test public void getLogger() throws Exception { Assert.assertNull(RpcLoggerFactory.getLogger(null, "appname1")); Logger logger1 = RpcLoggerFactory.getLogger("xxx", "appname1"); Assert.assertNotNull(logger1); Logger logger2 = RpcLoggerFactory.getLogger("xxx", "appname1"); Assert.assertNotNull(logger1); Assert.assertEquals(logger1, logger2); Logger logger3 = RpcLoggerFactory.getLogger("xxx", "appname2"); Assert.assertFalse(logger1.equals(logger3)); }