-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/java/de/tudarmstadt/informatik/hostage/protocols/AMQP/LogBackFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package de.tudarmstadt.informatik.hostage.protocols.AMQP; | ||
|
||
import java.util.ArrayList; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
import ch.qos.logback.classic.spi.ILoggingEvent; | ||
import ch.qos.logback.core.filter.Filter; | ||
import ch.qos.logback.core.spi.FilterReply; | ||
|
||
public class LogBackFilter extends Filter<ILoggingEvent> { | ||
final Pattern secondPattern = Pattern.compile("\\Q[\\ESMB\\Q]\\E Connection from*"); | ||
private static ArrayList<String> packets= new ArrayList<>(); | ||
|
||
/** | ||
* If the decision is <code>{@link FilterReply#DENY}</code>, then the event will be | ||
* dropped. If the decision is <code>{@link FilterReply#NEUTRAL}</code>, then the next | ||
* filter, if any, will be invoked. If the decision is | ||
* <code>{@link FilterReply#ACCEPT}</code> then the event will be logged without | ||
* consulting with other filters in the chain. | ||
* | ||
* @param event The event to decide upon. | ||
* @return filter result (ACCEPT, DENY, NEUTRAL) | ||
*/ | ||
@Override | ||
public FilterReply decide(ILoggingEvent event) { | ||
System.out.println("Received!!!!!!!!..........."+event.getMessage()); | ||
|
||
Matcher matcher = secondPattern.matcher(event.getMessage()); | ||
if (matcher.find()) { | ||
packets.add(event.getMessage()); | ||
return FilterReply.ACCEPT; | ||
} | ||
return FilterReply.DENY; } | ||
|
||
public ArrayList<String> getList(){ | ||
return packets; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.