public void start() { String optStr = getFirstOption(); if (optStr != null) { key = optStr; super.start(); } }
@Override public void stop() { key = null; super.stop(); }
ClassicConverter converter = new LoggerConverter(); this.optionList.add("5"); converter.setOptionList(this.optionList); converter.start(); StringBuilder buf = new StringBuilder(); converter.write(buf, le); assertEquals(witness.toString(), buf.toString());
@Test public void contextNameConverter() { ClassicConverter converter = new ContextNameConverter(); // see http://jira.qos.ch/browse/LBCLASSIC-149 LoggerContext lcOther = new LoggerContext(); lcOther.setName("another"); converter.setContext(lcOther); lc.setName("aValue"); ILoggingEvent event = makeLoggingEvent(null); String result = converter.convert(event); assertEquals("aValue", result); }
@Nullable final List<Object> contextValues) { final Map<String, Object> context = new LinkedHashMap<>(); context.put("host", KeyValueSerializationHelper.HOST_CONVERTER.convert(event)); context.put("processId", KeyValueSerializationHelper.PROCESS_CONVERTER.convert(event)); context.put("threadId", KeyValueSerializationHelper.THREAD_CONVERTER.convert(event)); if (contextKeys != null) { final int contextValuesLength = contextValues == null ? 0 : contextValues.size();
@Test public void testLogger() { { ClassicConverter converter = new LoggerConverter(); StringBuilder buf = new StringBuilder(); converter.write(buf, le); assertEquals(this.getClass().getName(), buf.toString()); } { ClassicConverter converter = new LoggerConverter(); this.optionList.add("20"); converter.setOptionList(this.optionList); converter.start(); StringBuilder buf = new StringBuilder(); converter.write(buf, le); assertEquals("c.q.l.c.p.ConverterTest", buf.toString()); } { DynamicConverter<ILoggingEvent> converter = new LoggerConverter(); this.optionList.clear(); this.optionList.add("0"); converter.setOptionList(this.optionList); converter.start(); StringBuilder buf = new StringBuilder(); converter.write(buf, le); assertEquals("ConverterTest", buf.toString()); } }
context.put("host", StenoSerializationHelper.HOST_CONVERTER.convert(event)); context.put("processId", StenoSerializationHelper.PROCESS_CONVERTER.convert(event)); context.put("threadId", StenoSerializationHelper.THREAD_CONVERTER.convert(event)); context.put("logger", StenoSerializationHelper.CONDENSED_LOGGER_CONVERTER.convert(event)); } else { context.put("logger", StenoSerializationHelper.LOGGER_CONVERTER.convert(event)); context.put("file", StenoSerializationHelper.FILE_CONVERTER.convert(event)); context.put("class", StenoSerializationHelper.CLASS_CONVERTER.convert(event)); context.put("method", StenoSerializationHelper.METHOD_CONVERTER.convert(event)); context.put("line", StenoSerializationHelper.LINE_CONVERTER.convert(event));
@Override public void start() { String[] keyInfo = extractDefaultReplacement(getFirstOption()); key = keyInfo[0]; if (keyInfo[1] != null) { defaultValue = keyInfo[1]; } super.start(); }
@Override public void stop() { key = null; super.stop(); }
public void start() { int errorCount = 0; String facilityStr = getFirstOption(); if (facilityStr == null) { addError("was expecting a facility string as an option"); return; } facility = SyslogAppenderBase.facilityStringToint(facilityStr); localHostName = getLocalHostname(); try { // hours should be in 0-23, see also http://jira.qos.ch/browse/LBCLASSIC-48 simpleMonthFormat = new SimpleDateFormat("MMM", Locale.US); simpleTimeFormat = new SimpleDateFormat("HH:mm:ss", Locale.US); } catch (IllegalArgumentException e) { addError("Could not instantiate SimpleDateFormat", e); errorCount++; } if (errorCount == 0) { super.start(); } }
@Override public void stop() { key = null; super.stop(); }
public void start() { String optStr = getFirstOption(); if (optStr != null) { key = optStr; super.start(); } }
@Override public void stop() { key = null; super.stop(); }
@Override public void start() { String[] keyInfo = extractDefaultReplacement(getFirstOption()); key = keyInfo[0]; if (keyInfo[1] != null) { defaultValue = keyInfo[1]; } super.start(); }
@Override public void stop() { key = null; super.stop(); }
public void start() { int errorCount = 0; String facilityStr = getFirstOption(); if (facilityStr == null) { addError("was expecting a facility string as an option"); return; } facility = SyslogAppenderBase.facilityStringToint(facilityStr); localHostName = getLocalHostname(); try { // hours should be in 0-23, see also http://jira.qos.ch/browse/LBCLASSIC-48 simpleMonthFormat = new SimpleDateFormat("MMM", Locale.US); simpleTimeFormat = new SimpleDateFormat("HH:mm:ss", Locale.US); } catch (IllegalArgumentException e) { addError("Could not instantiate SimpleDateFormat", e); errorCount++; } if(errorCount == 0) { super.start(); } }
@Override public void stop() { key = null; super.stop(); }
@Override public void start() { super.start(); } }
@Override public void stop() { key = null; super.stop(); }
@Override public void start() { super.start(); }