@Test public void testFirst4Mask(){ String masked = mc.convert(getEvent("orderNumber=77887765567abc123")); assertEquals("orderNumber=*****c123", masked); masked = mc.convert(getEvent("orderNumber:abc123")); assertEquals("orderNumber:*****c123", masked); masked = mc.convert(getEvent("\"orderNumber\":\"abc123\"")); assertEquals("\"orderNumber\":\"*****c123\"", masked); masked = mc.convert(getEvent("\"orderNumber\":\"abc123\",signature=foo")); assertEquals("\"orderNumber\":\"*****c123\",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();  }