better logging

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6361 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 2275f885a8
commit e1fba41cad

@ -544,7 +544,7 @@ public class ArrayStack implements BLOB {
} catch (final InterruptedException e) { } catch (final InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (final ExecutionException e) { } catch (final ExecutionException e) {
e.printStackTrace(); Log.logSevere("ArrayStack", "", e);
throw new RuntimeException(e.getCause()); throw new RuntimeException(e.getCause());
} }
//System.out.println("*DEBUG SplitTable fail.time = " + (System.currentTimeMillis() - start) + " ms"); //System.out.println("*DEBUG SplitTable fail.time = " + (System.currentTimeMillis() - start) + " ms");
@ -610,7 +610,7 @@ public class ArrayStack implements BLOB {
this.next = b.get(key); this.next = b.get(key);
if (this.next != null) return; if (this.next != null) return;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.logSevere("ArrayStack", "", e);
this.next = null; this.next = null;
return; return;
} }
@ -768,7 +768,6 @@ public class ArrayStack implements BLOB {
Log.logSevere("ArrayStack", "cannot close writing: " + e.getMessage(), e); Log.logSevere("ArrayStack", "cannot close writing: " + e.getMessage(), e);
FileUtils.deletedelete(tmpFile); FileUtils.deletedelete(tmpFile);
FileUtils.deletedelete(newFile); FileUtils.deletedelete(newFile);
e.printStackTrace();
return null; return null;
} }
} }

@ -40,6 +40,7 @@ import java.util.zip.GZIPOutputStream;
import de.anomic.kelondro.order.ByteOrder; import de.anomic.kelondro.order.ByteOrder;
import de.anomic.kelondro.order.CloneableIterator; import de.anomic.kelondro.order.CloneableIterator;
import de.anomic.kelondro.util.ByteArray; import de.anomic.kelondro.util.ByteArray;
import de.anomic.yacy.logging.Log;
public class Compressor implements BLOB { public class Compressor implements BLOB {
@ -82,7 +83,7 @@ public class Compressor implements BLOB {
try { try {
flushAll(); flushAll();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.logSevere("Compressor", "", e);
} }
this.backend.close(writeIDX); this.backend.close(writeIDX);
} }
@ -108,7 +109,7 @@ public class Compressor implements BLOB {
baos.close(); baos.close();
return baos.toByteArray(); return baos.toByteArray();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.logSevere("Compressor", "", e);
return null; return null;
} }
} }

@ -418,7 +418,7 @@ public final class Row {
try { try {
setCol(column, (cell == null) ? null : cell.getBytes(encoding)); setCol(column, (cell == null) ? null : cell.getBytes(encoding));
} catch (final UnsupportedEncodingException e) { } catch (final UnsupportedEncodingException e) {
e.printStackTrace(); Log.logSevere("Row", "", e);
} }
} }
@ -429,7 +429,7 @@ public final class Row {
try { try {
setCol(nick, cell.getBytes(encoding)); setCol(nick, cell.getBytes(encoding));
} catch (final UnsupportedEncodingException e) { } catch (final UnsupportedEncodingException e) {
e.printStackTrace(); Log.logSevere("Row", "", e);
} }
} }

@ -554,9 +554,9 @@ public class RowCollection implements Iterable<Row.Entry> {
sort2.get(); sort2.get();
sort3.get(); sort3.get();
} catch (final InterruptedException e) { } catch (final InterruptedException e) {
e.printStackTrace(); Log.logSevere("RowCollection", "", e);
} catch (final ExecutionException e) { } catch (final ExecutionException e) {
e.printStackTrace(); Log.logSevere("RowCollection", "", e);
} }
} else { } else {
qsort(0, p, 0, swapspace); qsort(0, p, 0, swapspace);
@ -589,9 +589,9 @@ public class RowCollection implements Iterable<Row.Entry> {
try { try {
part.get(); part.get();
} catch (final InterruptedException e) { } catch (final InterruptedException e) {
e.printStackTrace(); Log.logSevere("RowCollection", "", e);
} catch (final ExecutionException e) { } catch (final ExecutionException e) {
e.printStackTrace(); Log.logSevere("RowCollection", "", e);
} }
} else { } else {
qsort(0, p, 0, swapspace); qsort(0, p, 0, swapspace);

@ -405,15 +405,13 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.E
try { try {
c0.sort(); c0.sort();
} catch (Exception e) { } catch (Exception e) {
Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage()); Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage(), e);
e.printStackTrace();
c0.clear(); c0.clear();
} }
try { try {
c1.sort(); c1.sort();
} catch (Exception e) { } catch (Exception e) {
Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage()); Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage(), e);
e.printStackTrace();
c1.clear(); c1.clear();
} }
int c0i = 0, c1i = 0; int c0i = 0, c1i = 0;

@ -156,7 +156,7 @@ public class SplitTable implements ObjectIndex {
try { try {
d = DateFormatter.parseShortMilliSecond(tablefile[i].substring(prefix.length() + 1, prefix.length() + 18)); d = DateFormatter.parseShortMilliSecond(tablefile[i].substring(prefix.length() + 1, prefix.length() + 18));
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); Log.logSevere("SplitTable", "", e);
continue; continue;
} }
time = d.getTime(); time = d.getTime();
@ -296,7 +296,7 @@ public class SplitTable implements ObjectIndex {
try { try {
d = DateFormatter.parseShortMilliSecond(name.substring(prefix.length() + 1, prefix.length() + 18)).getTime(); d = DateFormatter.parseShortMilliSecond(name.substring(prefix.length() + 1, prefix.length() + 18)).getTime();
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); Log.logSevere("SplitTable", "", e);
d = 0; d = 0;
} }
if (d + this.fileAgeLimit < System.currentTimeMillis() || new File(this.path, name).length() >= this.fileSizeLimit) { if (d + this.fileAgeLimit < System.currentTimeMillis() || new File(this.path, name).length() >= this.fileSizeLimit) {
@ -397,7 +397,7 @@ public class SplitTable implements ObjectIndex {
try { try {
order = orderQueue.take(); order = orderQueue.take();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); Log.logSevere("SplitTable", "", e);
continue; continue;
} }
if (order == poisonDiscoverOrder) break; if (order == poisonDiscoverOrder) break;
@ -409,7 +409,7 @@ public class SplitTable implements ObjectIndex {
order.challenge.commitNoDiscovery(); order.challenge.commitNoDiscovery();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.logSevere("SplitTable", "", e);
order.challenge.commitNoDiscovery(); order.challenge.commitNoDiscovery();
} }
} }
@ -428,7 +428,7 @@ public class SplitTable implements ObjectIndex {
try { try {
this.orderQueue.put(new DiscoverOrder(challenge, i.next())); this.orderQueue.put(new DiscoverOrder(challenge, i.next()));
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); Log.logSevere("SplitTable", "", e);
} }
} }
} }
@ -502,7 +502,7 @@ public class SplitTable implements ObjectIndex {
} catch (final InterruptedException e) { } catch (final InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (final ExecutionException e) { } catch (final ExecutionException e) {
e.printStackTrace(); Log.logSevere("SplitTable", "", e);
throw new RuntimeException(e.getCause()); throw new RuntimeException(e.getCause());
} }
return null; return null;
@ -582,7 +582,7 @@ public class SplitTable implements ObjectIndex {
try { try {
this.orderQueue.put(poisonDiscoverOrder); this.orderQueue.put(poisonDiscoverOrder);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); Log.logSevere("SplitTable", "", e);
} }
} }

@ -108,7 +108,7 @@ public class Table implements ObjectIndex {
fos = new FileOutputStream(tablefile); fos = new FileOutputStream(tablefile);
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
// should not happen // should not happen
e.printStackTrace(); Log.logSevere("Table", "", e);
} }
if (fos != null) try { fos.close(); } catch (final IOException e) {} if (fos != null) try { fos.close(); } catch (final IOException e) {}
} }
@ -227,10 +227,10 @@ public class Table implements ObjectIndex {
} }
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
// should never happen // should never happen
e.printStackTrace(); Log.logSevere("Table", "", e);
throw new kelondroException(e.getMessage()); throw new kelondroException(e.getMessage());
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); Log.logSevere("Table", "", e);
throw new kelondroException(e.getMessage()); throw new kelondroException(e.getMessage());
} }
@ -390,8 +390,7 @@ public class Table implements ObjectIndex {
try { try {
assert file.size() == index.size() : "file.size() = " + file.size() + ", index.size() = " + index.size(); assert file.size() == index.size() : "file.size() = " + file.size() + ", index.size() = " + index.size();
} catch (final IOException e) { } catch (final IOException e) {
// TODO Auto-generated catch block Log.logSevere("Table", "", e);
e.printStackTrace();
} }
assert table == null || table.size() == index.size() : "table.size() = " + table.size() + ", index.size() = " + index.size(); assert table == null || table.size() == index.size() : "table.size() = " + table.size() + ", index.size() = " + index.size();
return index.has(key); return index.has(key);
@ -603,7 +602,7 @@ public class Table implements ObjectIndex {
fos = new FileOutputStream(f); fos = new FileOutputStream(f);
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
// should not happen // should not happen
e.printStackTrace(); Log.logSevere("Table", "", e);
} }
if (fos != null) try { fos.close(); } catch (final IOException e) {} if (fos != null) try { fos.close(); } catch (final IOException e) {}
@ -613,7 +612,7 @@ public class Table implements ObjectIndex {
this.file = new BufferedRecords(new Records(f, rowdef.objectsize), this.buffersize); this.file = new BufferedRecords(new Records(f, rowdef.objectsize), this.buffersize);
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
// should never happen // should never happen
e.printStackTrace(); Log.logSevere("Table", "", e);
} }
// initialize index and copy table // initialize index and copy table
@ -644,7 +643,7 @@ public class Table implements ObjectIndex {
try { try {
return new rowIteratorNoOrder(); return new rowIteratorNoOrder();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.logSevere("Table", "", e);
return null; return null;
} }
} }
@ -701,7 +700,7 @@ public class Table implements ObjectIndex {
try { try {
file.get(this.c, b, 0); file.get(this.c, b, 0);
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); Log.logSevere("Table", "", e);
return null; return null;
} }
} else { } else {

Loading…
Cancel
Save