/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
protected static void dumpMemoryTrace47(java.util.logging.Logger logger) { MemoryHandler mHand = null; if (logger!= null) { Handler[] handlers = logger.getHandlers(); for (int i=0; i<handlers.length; i++) { if (handlers[i] instanceof java.util.logging.MemoryHandler) { synchronized (handlers[i]) { mHand = ((java.util.logging.MemoryHandler)handlers[i]); mHand.push(); return; } // synchronized (handler). } } // for handlers... dumpMemoryTrace47(logger.getParent()); } }
public String pushToString() { super.push(); return monHandle.logsToString(); }
@Override public void push() { super.push(); flush(); }
public String pushToString() { super.push(); return monHandle.logsToString(); } }
@Override public void push() { super.push(); flush(); } }
/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
class MyMemoryConsoleHandler { private Logger rootLogger; private MemoryHandler mh; private Logger l; private int size = 3; private int entries = 0; public MyMemoryConsoleHandler() { this.rootLogger = Logger.getLogger(""); this.rootLogger.removeHandler(rootLogger.getHandlers()[0]); ConsoleHandler ch = new ConsoleHandler(); this.l = Logger.getLogger("test"); this.mh = new MemoryHandler(ch,this.size,Level.OFF); } public synchronized void push() { this.mh.push(); if (this.entries > this.size) { this.l.severe("Entries in log discarded !!!"); this.mh.push(); } this.entries = 0; } public synchronized void addMessage(String m) { this.entries++; this.l.severe(m); } }
/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
/** * Put a given {@code LogRecord} into internal buffer. If given record is * not loggable, just return. Otherwise it is stored in the buffer. * Furthermore if the record's level is not less than the push level, the * push action is triggered to output all the buffered records to the target * handler, and the target handler will publish them. * * @param record * the log record */ @Override public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } if (cursor >= size) { cursor = 0; } buffer[cursor++] = record; if (record.getLevel().intValue() >= push.intValue()) { push(); } }
protected static void dumpMemoryTrace47(java.util.logging.Logger logger) { MemoryHandler mHand = null; if (logger!= null) { Handler[] handlers = logger.getHandlers(); for (int i=0; i<handlers.length; i++) { if (handlers[i] instanceof java.util.logging.MemoryHandler) { synchronized (handlers[i]) { mHand = ((java.util.logging.MemoryHandler)handlers[i]); mHand.push(); return; } // synchronized (handler). } } // for handlers... dumpMemoryTrace47(logger.getParent()); } }
protected static void dumpMemoryTrace47(java.util.logging.Logger logger) { MemoryHandler mHand = null; if (logger!= null) { Handler[] handlers = logger.getHandlers(); for (int i=0; i<handlers.length; i++) { if (handlers[i] instanceof java.util.logging.MemoryHandler) { synchronized (handlers[i]) { mHand = ((java.util.logging.MemoryHandler)handlers[i]); mHand.push(); return; } // synchronized (handler). } } // for handlers... dumpMemoryTrace47(logger.getParent()); } }
protected static void dumpMemoryTrace47(java.util.logging.Logger logger) { MemoryHandler mHand = null; if (logger!= null) { Handler[] handlers = logger.getHandlers(); for (int i=0; i<handlers.length; i++) { if (handlers[i] instanceof MemoryHandler) { synchronized (handlers[i]) { mHand = ((MemoryHandler)handlers[i]); mHand.push(); return; } // synchronized (handler). } } // for handlers... dumpMemoryTrace47(logger.getParent()); } }
public void push() { fileHandler.setFormatter(new LogFormatter()); super.push(); LogRecord emptyLine = new LogRecord(Level.INFO, ""); emptyLine.setLoggerName(""); fileHandler.publish(emptyLine); LogRecord line = new LogRecord(Level.INFO, "---- END OF TRIGGERED PUSH ---------------------------------------------------"); line.setLoggerName(""); fileHandler.publish(line); fileHandler.publish(emptyLine); fileHandler.publish(emptyLine); } }
try { if (h instanceof MemoryHandler) { ((MemoryHandler) h).push();