log tweaks

This commit is contained in:
zzz
2011-03-23 02:22:19 +00:00
parent 7e0d0e2b01
commit c85931cbc5
4 changed files with 13 additions and 11 deletions

View File

@ -202,9 +202,10 @@ public class BlockfileNamingService extends DummyNamingService {
if (_log.shouldLog(Log.INFO))
_log.info("DB init took " + DataHelper.formatDuration(_context.clock().now() - start));
if (total <= 0)
_log.error("Warning - initialized database with zero entries");
_log.logAlways(Log.WARN, "No hosts.txt files found, Initialized hosts database with zero entries");
return rv;
} catch (RuntimeException e) {
_log.error("Failed to initialize database", e);
throw new IOException(e.toString());
}
}
@ -245,9 +246,11 @@ public class BlockfileNamingService extends DummyNamingService {
if (skiplists.isEmpty())
skiplists.add(FALLBACK_LIST);
_lists.addAll(skiplists);
_log.error("DB init took " + DataHelper.formatDuration(_context.clock().now() - start));
if (_log.shouldLog(Log.INFO))
_log.info("DB init took " + DataHelper.formatDuration(_context.clock().now() - start));
return bf;
} catch (RuntimeException e) {
_log.error("Failed to initialize database", e);
throw new IOException(e.toString());
}
}
@ -262,8 +265,6 @@ public class BlockfileNamingService extends DummyNamingService {
if (sl == null)
return null;
DestEntry rv = (DestEntry) sl.get(key);
// Control memory usage
//////// _bf.closeIndex(listname);
return rv;
} catch (IOException ioe) {
_log.error("DB Lookup error", ioe);
@ -292,8 +293,6 @@ public class BlockfileNamingService extends DummyNamingService {
if (source != null)
props.setProperty(PROP_SOURCE, source);
addEntry(sl, key, dest, props);
// Control memory usage
////// bf.closeIndex(listname);
} catch (IOException ioe) {
_log.error("DB add error", ioe);
// delete index??
@ -752,7 +751,6 @@ public class BlockfileNamingService extends DummyNamingService {
public static void main(String[] args) {
BlockfileNamingService bns = new BlockfileNamingService(I2PAppContext.getGlobalContext());
//System.out.println("zzz.i2p: " + bns.lookup("zzz.i2p"));
List<String> names = null;
try {
Properties props = new Properties();

View File

@ -432,7 +432,7 @@ public abstract class NamingService {
instance = (NamingService)con.newInstance(new Object[] { context });
} catch (Exception ex) {
Log log = context.logManager().getLog(NamingService.class);
log.error("Cannot load naming service " + impl, ex);
log.error("Cannot load naming service " + impl + ", only .b32.i2p lookups will succeed", ex);
instance = new DummyNamingService(context); // fallback
}
return instance;