Member Avatar

Ok, so I'm working on a web-project, I connected a custom hanlder to the root Logger in `contextInitialized()` of a ServletContextListener: @Override public void contextInitialized(ServletContextEvent sce) { Logger def = Logger.getLogger(""); Handler hand = new DatabaseLoggingHandler(); hand.setLevel(Level.WARNING); def.addHandler(hand); } which looks like: import java.io.PrintWriter; import java.io.StringWriter; import java.util.logging.LogRecord; import java.util.logging.Logger; import java.util.logging.Handler; import matrixpeckham.db.DBManager; public class DatabaseLoggingHandler extends Handler { private static final Logger LOG = Logger.getLogger(DatabaseLoggingHandler.class.getName()); @Override public void publish(LogRecord record) { String message = record.getMessage(); String logger = record.getLoggerName(); Throwable thr = record.getThrown(); String thrMess = ""; String thrStack = ""; if(thr!=null){ thrMess=thr.getMessage(); PrintWriter str = new PrintWriter(new …

+0 forum 0
Member Avatar

For reason I won't bore you with, I need to update an archive database periodically with typically blocks of 100-300 records. Each record has 6 visible fields in the database. Frequently 4 of the 6 fields have the same information in them for the whole block of data. For a good reason I do this by creating the required number of empty records in the database for the required block of data then manually editing each record. My intension was to complete the first record of the block, and then create a program that would read that record and then …

Member Avatar
+0 forum 8

The End.