Java Code Examples for ch.qos.logback.classic.spi.ILoggingEvent#getMessage()

The following examples show how to use ch.qos.logback.classic.spi.ILoggingEvent#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogFilter.java    From DimpleBlog with Apache License 2.0 6 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event) {
    StringBuilder exception = new StringBuilder();
    IThrowableProxy iThrowableProxy1 = event.getThrowableProxy();
    if (iThrowableProxy1 != null) {
        exception.append("<span class='excehtext'>" + iThrowableProxy1.getClassName() + " " + iThrowableProxy1.getMessage() + "</span></br>");
        for (int i = 0; i < iThrowableProxy1.getStackTraceElementProxyArray().length; i++) {
            exception.append("<span class='excetext'>" + iThrowableProxy1.getStackTraceElementProxyArray()[i].toString() + "</span></br>");
        }
    }
    LoggerMessage loggerMessage = new LoggerMessage(
            event.getMessage()
            , DateFormat.getDateTimeInstance().format(new Date(event.getTimeStamp())),
            event.getThreadName(),
            event.getLoggerName(),
            event.getLevel().levelStr,
            exception.toString(),
            ""
    );
    LoggerQueue.getInstance().push(loggerMessage);
    return FilterReply.ACCEPT;
}
 
Example 2
Source File: SiegeFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[SIEGE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 3
Source File: DefinedRegexMaskingConverter.java    From owasp-security-logging with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 4
Source File: NOPAppender.java    From logbook with MIT License 5 votes vote down vote up
@Override
protected void append(ILoggingEvent eventObject) {
    // make sure the event call cannot be discarded by the JIT compiler
    if(eventObject == null || eventObject.getMessage() == null) {
        throw new IllegalArgumentException();
    }
}
 
Example 5
Source File: LogbackRecorder.java    From jhipster with Apache License 2.0 5 votes vote down vote up
Event(ILoggingEvent event) {
    this.marker = event.getMarker();
    this.level = event.getLevel().toString();
    this.message = event.getMessage();
    this.arguments = event.getArgumentArray();
    final IThrowableProxy proxy = event.getThrowableProxy();
    this.thrown = proxy == null ? null : proxy.getClassName() + ": " + proxy.getMessage();
}
 
Example 6
Source File: SystemMailServiceFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[SYSMAILSERVICE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 7
Source File: AuditFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[AUDIT]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 8
Source File: DropFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[DROP]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 9
Source File: InGameShopFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[INGAMESHOP]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 10
Source File: ThrowablePresentFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (message instanceof Throwable) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 11
Source File: ChatLogFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if chatlog,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[MESSAGE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 12
Source File: AutoGroupFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[AUTOGROUPSERVICE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 13
Source File: GmAuditFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[ADMIN COMMAND]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 14
Source File: ItemFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[ITEM]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 15
Source File: CraftFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[CRAFT]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 16
Source File: VeteranRewardsFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[VETERANREWARD]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 17
Source File: LogFilter.java    From ticket with GNU General Public License v3.0 4 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event) {
    LoggerMessage loggerMessage = new LoggerMessage(event.getMessage(), DateFormat.getDateTimeInstance().format(new Date(event.getTimeStamp())), event.getThreadName(), event.getLoggerName(), event.getLevel().levelStr);
    // LogUtil.push(loggerMessage.toString());
    return FilterReply.ACCEPT;
}
 
Example 18
Source File: TaskLogsFilter.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
private TaskLoggingEvent toTaskLoggerEvent(final ILoggingEvent event) {
  Logger logger = LoggerFactory.getLogger(event.getLoggerName());
  return new TaskLoggingEvent(logger, event.getMessage(), event.getArgumentArray());
}
 
Example 19
Source File: CEFLoggingLayout.java    From owasp-security-logging with Apache License 2.0 4 votes vote down vote up
public String doLayout(ILoggingEvent event) {
	Prefix prefix = new Prefix();
	prefix.name = event.getMessage();
	return prefix.toString();
}