public DateFormatCache(int size, String format, DateFormatCache parent) { cacheSize = size; this.format = tidyFormat(format); Cache parentCache = null; if (parent != null) { synchronized(parent) { parentCache = parent.cache; } } cache = new Cache(parentCache); }
@Override public void close() { if (closed) return; closed = true; // TODO Auto-generated method stub super.close(); }
public boolean flush() { if (handler.closed) { return false; } else { handler.publishInternal(record); return true; } }
@Override public void readConfiguration(InputStream is) throws IOException, SecurityException { checkAccess(); reset(); readConfiguration(is, Thread.currentThread().getContextClassLoader()); }
@Override public void readConfiguration() throws IOException, SecurityException { checkAccess(); readConfiguration(Thread.currentThread().getContextClassLoader()); }
void setParentLogger(final Logger parent) { for (final Iterator<LogNode> iter = children.values().iterator(); iter.hasNext();) { final LogNode childNode = iter.next(); if (childNode.logger == null) { childNode.setParentLogger(parent); } else { doSetParentLogger(childNode.logger, parent); } } }
public FileHandler(String directory, String prefix, String suffix) { this.directory = directory; this.prefix = prefix; this.suffix = suffix; configure(); openWriter(); }
@Override public void run() { if (useShutdownHook) { shutdown(); } }
@Override public Void run() { try { readConfiguration(classLoaderParam); } catch (IOException e) { // Ignore } return null; } });
/** * Shuts down the logging system. */ public void shutdown() { // The JVM is being shutdown. Make sure all loggers for all class // loaders are shutdown for (ClassLoaderLogInfo clLogInfo : classLoaderLoggers.values()) { resetLoggers(clLogInfo); } }
public ClassLoaderLogManager() { super(); try { Runtime.getRuntime().addShutdownHook(new Cleaner()); } catch (IllegalStateException ise) { // We are probably already being shutdown. Ignore this error. } }
/** * Get the logger associated with the specified name inside * the classloader local configuration. If this returns null, * and the call originated for Logger.getLogger, a new * logger with the specified name will be instantiated and * added using addLogger. * * @param name The name of the logger to retrieve */ @Override public synchronized Logger getLogger(final String name) { ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); return getClassLoaderInfo(classLoader).loggers.get(name); }
/** * Close the currently open log file (if any). */ @Override public void close() { closeWriter(); }
@Override protected void open() { if(!closed) return; closed = false; // TODO Auto-generated method stub super.open(); }
/** * Open the new log file for the date specified by <code>date</code>. */ protected void open() { openWriter(); }
public AsyncFileHandler(String directory, String prefix, String suffix) { super(directory, prefix, suffix); open(); }
protected void publishInternal(LogRecord record) { super.publish(record); }
@Override protected DateFormatCache initialValue() { return new DateFormatCache(localCacheSize, timeFormat, globalDateCache); } };
protected void addTimestamp(StringBuilder buf, long timestamp) { buf.append(localDateCache.get().getFormat(timestamp)); long frac = timestamp % 1000; buf.append('.'); if (frac < 100) { if (frac < 10) { buf.append('0'); buf.append('0'); } else { buf.append('0'); } } buf.append(frac); } }