public int getSeverityForEvent(Object eventObject) { if (eventObject instanceof ILoggingEvent) { ILoggingEvent event = (ILoggingEvent) eventObject; return LevelToSyslogSeverity.convert(event); } else { return Level.INFO_INT; } }
@Override public String doLayout(final ILoggingEvent event) { final String shortMessage = shortPatternLayout.doLayout(event); final String fullMessage = fullPatternLayout.doLayout(event); final double timestamp = event.getTimeStamp() / MSEC_DIVIDER; final Map<String, Object> additionalFields = mapAdditionalFields(event); final GelfMessage gelfMessage = new GelfMessage(originHost, shortMessage, fullMessage, timestamp, LevelToSyslogSeverity.convert(event), additionalFields); final String jsonStr = gelfMessage.toJSON(); return appendNewline ? jsonStr + System.lineSeparator() : jsonStr; }
public String convert(ILoggingEvent event) { StringBuilder sb = new StringBuilder(); int pri = facility + LevelToSyslogSeverity.convert(event); sb.append("<"); sb.append(pri); sb.append(">"); sb.append(computeTimeStampString(event.getTimeStamp())); sb.append(' '); sb.append(localHostName); sb.append(' '); return sb.toString(); }
/** * Convert a level to equivalent syslog severity. Only levels for printing * methods i.e DEBUG, WARN, INFO and ERROR are converted. * * @see ch.qos.logback.core.net.SyslogAppenderBase#getSeverityForEvent(java.lang.Object) */ public int getSeverityForEvent(Object eventObject) { if (eventObject instanceof ILoggingEvent) { ILoggingEvent event = (ILoggingEvent) eventObject; return LevelToSyslogSeverity.convert(event); } else { return SyslogIF.LEVEL_INFO; } }
public String convert(final ILoggingEvent event) { final StringBuilder sb = new StringBuilder(); final int pri = facility + LevelToSyslogSeverity.convert(event); sb.append("<"); sb.append(pri); sb.append(">"); computeTimeStampString(sb, event.getTimeStamp()); sb.append(' '); sb.append(localHostName); sb.append(' '); return sb.toString(); }
public String convert(final ILoggingEvent event) { final StringBuilder sb = new StringBuilder(); final int pri = facility + LevelToSyslogSeverity.convert(event); sb.append("<"); sb.append(pri); sb.append(">"); sb.append(computeTimeStampString(event.getTimeStamp())); sb.append(' '); sb.append(localHostName); sb.append(' '); return sb.toString(); }
/** * Convert a level to equivalent syslog severity. Only levels for printing * methods i.e DEBUG, WARN, INFO and ERROR are converted. * * @see ch.qos.logback.core.net.SyslogAppenderBase#getSeverityForEvent(java.lang.Object) */ @Override public int getSeverityForEvent(Object eventObject) { ILoggingEvent event = (ILoggingEvent) eventObject; return LevelToSyslogSeverity.convert(event); }