@Test public void testCompleteMask(){ String masked = mc.convert(getEvent("")); assertEquals("", masked); masked = mc.convert(getEvent("password=abc123")); assertEquals("password=*****", masked); masked = mc.convert(getEvent("password:abc123")); assertEquals("password:*****", masked); masked = mc.convert(getEvent("\"password\":\"abc123\"")); assertEquals("\"password\":\"*****\"", masked); masked = mc.convert(getEvent("\"password\":\"abc123\",signature=foo")); assertEquals("\"password\":\"*****\",signature=*****", masked); }
@Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; } }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }  }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }  @Override String convert(ILoggingEvent logEvent); @Override void start(); }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }  @Override String convert(ILoggingEvent logEvent); @Override void start();  }