mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
*) Bugfix for ViewLog problem with multiline logging messages
See: http://www.yacy-forum.de/viewtopic.php?t=2972 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2774 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
de5e233766
commit
5b114249ce
|
@ -48,6 +48,8 @@
|
|||
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import de.anomic.http.httpHeader;
|
||||
|
@ -62,7 +64,7 @@ public class ViewLog_p {
|
|||
String[] log = new String[0];
|
||||
boolean reversed = false;
|
||||
int lines = 200;
|
||||
String filter = ".*.*";
|
||||
String filter = ".*";
|
||||
|
||||
if(post != null){
|
||||
if(post.containsKey("mode") && ((String)post.get("mode")).equals("reversed")){
|
||||
|
@ -90,12 +92,25 @@ public class ViewLog_p {
|
|||
prop.put("lines", lines);
|
||||
prop.put("filter", filter);
|
||||
|
||||
// trying to compile the regular expression filter expression
|
||||
Matcher filterMatcher = null;
|
||||
try {
|
||||
Pattern filterPattern = Pattern.compile(filter,Pattern.MULTILINE);
|
||||
filterMatcher = filterPattern.matcher("");
|
||||
} catch (PatternSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
int level = 0;
|
||||
int lc = 0;
|
||||
for (int i=0; i < log.length; i++) {
|
||||
String nextLogLine = log[i].trim();
|
||||
try {if (!(nextLogLine.matches(filter))) continue;} catch (PatternSyntaxException e) {}
|
||||
|
||||
if (filterMatcher != null) {
|
||||
filterMatcher.reset(nextLogLine);
|
||||
if (!filterMatcher.find()) continue;
|
||||
}
|
||||
|
||||
if (nextLogLine.startsWith("E ")) level = 4;
|
||||
else if (nextLogLine.startsWith("W ")) level = 3;
|
||||
|
|
|
@ -193,8 +193,6 @@ public class GuiHandler extends Handler{
|
|||
if ((lineCount > this.count)||(lineCount < 0)) lineCount = this.count;
|
||||
|
||||
ArrayList logMessages = new ArrayList(this.count);
|
||||
logMessages.add("Testmessage:\r\nline1\r\nline2");
|
||||
|
||||
Formatter logFormatter = getFormatter();
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue
Block a user