public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase<E> plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
@Override public void start() { if (getPattern().equalsIgnoreCase(CLF_PATTERN_NAME) || getPattern().equalsIgnoreCase(CLF_PATTERN_NAME_2)) { setPattern(CLF_PATTERN); } else if (getPattern().equalsIgnoreCase(COMBINED_PATTERN_NAME)) { setPattern(COMBINED_PATTERN); } super.start(); }
private void startWrapped(Layout<Event> wrapped) { if (wrapped instanceof PatternLayoutBase) { /* * Don't ensure exception output (for ILoggingEvents) * or line separation (for IAccessEvents) */ PatternLayoutBase<Event> layout = (PatternLayoutBase<Event>) wrapped; layout.setPostCompileProcessor(null); /* * The pattern will be re-parsed during start. * Needed so that the pattern is re-parsed without * the postCompileProcessor. */ layout.start(); } if (wrapped != null && !wrapped.isStarted()) { wrapped.start(); } }
protected PatternLayoutBase<Event> buildLayout(String format) { PatternLayoutBase<Event> layout = createLayout(); layout.setContext(contextAware.getContext()); layout.setPattern(format); layout.setPostCompileProcessor(null); // Remove EnsureLineSeparation which is there by default layout.start(); return layout; }
public AbstractPropertyAndEncoder(Property property, Context context) { this.property = property; this.layout = getLayout(); this.layout.setContext(context); this.layout.setPattern(property.getValue()); this.layout.setPostCompileProcessor(null); this.layout.start(); }
@Test public void testEscapeClosingParentheses() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("x(%OTT\\)y"); plb.start(); String s = plb.doLayout(new Object()); assertEquals("x(123)y", s); }
@Test public void testEscapeBothParentheses() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("x\\(%OTT\\)y"); plb.start(); String s = plb.doLayout(new Object()); assertEquals("x(123)y", s); }
@Test public void testPercentAsLiteral() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("hello \\% world"); plb.start(); String s = plb.doLayout(new Object()); assertEquals("hello % world", s); }
@Test public void testOK() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("x%OTT"); plb.start(); String s = plb.doLayout(new Object()); //System.out.println(s); //StatusManager sm = context.getStatusManager(); //StatusPrinter.print(sm); assertEquals("x123", s); }
/** * This test checks that the pattern layout implementation starts its * converters. ExceptionalConverter throws an exception if it's convert * method is called before being started. */ @Test public void testConverterStart() { PatternLayoutBase<E> plb = getPatternLayoutBase(); plb.setContext(getContext()); plb.getInstanceConverterMap().put("EX", ExceptionalConverter.class.getName()); plb.setPattern("%EX"); plb.start(); String result = plb.doLayout(getEventObject()); assertFalse(result.contains("%PARSER_ERROR_EX")); //System.out.println("========="+result); }
@Test public void testEmptyPattern() { //System.out.println("testNullPattern"); PatternLayoutBase<E> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern(""); plb.start(); String s = plb.doLayout(getEventObject()); assertEquals("", s); StatusChecker checker = new StatusChecker(context.getStatusManager()); //StatusPrinter.print(context); checker.assertContainsMatch("Empty or null pattern."); }
@Test public void testNullPattern() { //System.out.println("testNullPattern"); PatternLayoutBase<E> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern(null); plb.start(); String s = plb.doLayout(getEventObject()); assertEquals("", s); StatusChecker checker = new StatusChecker(context.getStatusManager()); //StatusPrinter.print(context); checker.assertContainsMatch("Empty or null pattern."); }