@Test public void nullMessage() { LoggingEvent event = new LoggingEvent("", logger, Level.INFO, null, null, null); event.setTimeStamp(0); String result = layout.doLayout(event); String resultSuffix = result.substring(13).trim(); assertTrue("[" + resultSuffix + "] did not match regexs", resultSuffix.matches("\\[.*\\] INFO ch.qos.logback.classic.layout.TTLLLayoutTest - null")); }
@Override public String doLayout(ILoggingEvent event) { if (!isStarted()) { return CoreConstants.EMPTY_STRING; } StringBuilder sb = new StringBuilder(); long timestamp = event.getTimeStamp(); sb.append(cachingDateFormatter.format(timestamp)); sb.append(" ["); sb.append(event.getThreadName()); sb.append("] "); sb.append(event.getLevel().toString()); sb.append(" "); sb.append(event.getLoggerName()); sb.append(" - "); sb.append(event.getFormattedMessage()); sb.append(CoreConstants.LINE_SEPARATOR); IThrowableProxy tp = event.getThrowableProxy(); if (tp != null) { String stackTrace = tpc.convert(event); sb.append(stackTrace); } return sb.toString(); }
TTLLLayout extends LayoutBase<ILoggingEvent> { @Override public String doLayout(ILoggingEvent event) { if (!isStarted()) { return CoreConstants.EMPTY_STRING; } StringBuilder sb = new StringBuilder(); long timestamp = event.getTimeStamp(); sb.append(cachingDateFormatter.format(timestamp)); sb.append(" ["); sb.append(event.getThreadName()); sb.append("] "); sb.append(event.getLevel().toString()); sb.append(" "); sb.append(event.getLoggerName()); sb.append(" - "); sb.append(event.getFormattedMessage()); sb.append(CoreConstants.LINE_SEPARATOR); IThrowableProxy tp = event.getThrowableProxy(); if (tp != null) { String stackTrace = tpc.convert(event); sb.append(stackTrace); } return sb.toString(); } }
TTLLLayout extends LayoutBase<ILoggingEvent> { @Override public String doLayout(ILoggingEvent event) { if (!isStarted()) { return CoreConstants.EMPTY_STRING; } StringBuilder sb = new StringBuilder(); long timestamp = event.getTimeStamp(); sb.append(cachingDateFormatter.format(timestamp)); sb.append(" ["); sb.append(event.getThreadName()); sb.append("] "); sb.append(event.getLevel().toString()); sb.append(" "); sb.append(event.getLoggerName()); sb.append(" - "); sb.append(event.getFormattedMessage()); sb.append(CoreConstants.LINE_SEPARATOR); IThrowableProxy tp = event.getThrowableProxy(); if (tp != null) { String stackTrace = tpc.convert(event); sb.append(stackTrace); } return sb.toString(); }  }
TTLLLayout extends LayoutBase<ILoggingEvent> { @Override public String doLayout(ILoggingEvent event) { if (!isStarted()) { return CoreConstants.EMPTY_STRING; } StringBuilder sb = new StringBuilder(); long timestamp = event.getTimeStamp(); sb.append(cachingDateFormatter.format(timestamp)); sb.append(" ["); sb.append(event.getThreadName()); sb.append("] "); sb.append(event.getLevel().toString()); sb.append(" "); sb.append(event.getLoggerName()); sb.append(" - "); sb.append(event.getFormattedMessage()); sb.append(CoreConstants.LINE_SEPARATOR); IThrowableProxy tp = event.getThrowableProxy(); if (tp != null) { String stackTrace = tpc.convert(event); sb.append(stackTrace); } return sb.toString(); }  @Override void start(); @Override String doLayout(ILoggingEvent event); }
TTLLLayout extends LayoutBase<ILoggingEvent> { @Override public String doLayout(ILoggingEvent event) { if (!isStarted()) { return CoreConstants.EMPTY_STRING; } StringBuilder sb = new StringBuilder(); long timestamp = event.getTimeStamp(); sb.append(cachingDateFormatter.format(timestamp)); sb.append(" ["); sb.append(event.getThreadName()); sb.append("] "); sb.append(event.getLevel().toString()); sb.append(" "); sb.append(event.getLoggerName()); sb.append(" - "); sb.append(event.getFormattedMessage()); sb.append(CoreConstants.LINE_SEPARATOR); IThrowableProxy tp = event.getThrowableProxy(); if (tp != null) { String stackTrace = tpc.convert(event); sb.append(stackTrace); } return sb.toString(); }  @Override void start(); @Override String doLayout(ILoggingEvent event);  }