/** * Returns a <code>ThreadGroup</code> whose {@link * ThreadGroup#uncaughtException} method logs to both {#link * System#err} and the given <code>LogWriterI18n</code>. * * @param name * The name of the <code>ThreadGroup</code> * @param logger * A <code>LogWriterI18n</code> to log uncaught exceptions to. It * is okay for this argument to be <code>null</code>. * * author David Whitlock * @since 3.0 */ public static LoggingThreadGroup createThreadGroup(String name, final LogWriterI18n logger) { return createThreadGroup(name, logger, null); }
/** * Returns true if "severe" log messages are enabled. * Returns false if "severe" log messages are disabled. */ public boolean severeEnabled() { return this.getLevel() <= SEVERE_LEVEL; } /**
protected static int levelNameToCode(String level) { return LogWriterImpl.levelNameToCode(level); } }
protected static String levelToString(int level) { return LogWriterImpl.levelToString(level); }
if (tempLogger instanceof LogWriterImpl) { LogWriterImpl loggerImpl = (LogWriterImpl)tempLogger; this.securityLogger = new SecurityLogWriter(loggerImpl.getLevel(), loggerImpl); LogWriterImpl.createThreadGroup("ConsoleDMDaemon", logger); this.joinProcessor = new JoinProcessor(); this.joinProcessor.start();
int[] intLogLevels = LogWriterImpl.allLevels; for (int level : intLogLevels) { if (level >= LogWriterImpl.levelNameToCode(logLevel)) { logLevels.add(LogWriterImpl.levelToString(level).toLowerCase());
config.getLogLevel()); if (logger.infoEnabled() && !Boolean.getBoolean(InternalLocator.INHIBIT_DM_BANNER)) { logger.info(Banner.getString(null)); if (logger.infoEnabled() && !Boolean.getBoolean(InternalLocator.INHIBIT_DM_BANNER)) { logger.info(Banner.getString(null)); logger.warning(firstMsg); } else { logger.info(firstMsg); if (logConfig && logger.configEnabled()) { logger.config(LocalizedStrings.InternalDistributedSystem_STARTUP_CONFIGURATIONN_0, config.toLoggerString()); logger.info(LocalizedStrings.InternalDistributedSystem_RUNNING_IN_LOCAL_MODE_SINCE_MCASTPORT_WAS_0_AND_LOCATORS_WAS_EMPTY); OSProcess.redirectOutput(config.getLogFile()); } catch (IOException e) { logger.error(e);
final LogWriterImpl logImpl = (LogWriterImpl)this.logger; ClientSharedUtils.initLogger("com.gemstone.gemfire", null, false, false, GemFireLevel.create(logImpl.getLevel()), logImpl.getHandler());
/** * Writes both a message and exception to this writer. * The message level is "severe". * @since 6.0 */ public void severe(StringId msgID, Object[] params) { severe(msgID, params, null); } /**
/** * Writes both a message and exception to this writer. * The message level is "warning". * @since 6.0 */ public void warning(StringId msgID, Throwable ex) { warning(msgID, null, ex); } /**
/** * Handles the special cases for {@link #levelToString(int)} including * such cases as the SECURITY_LOGGING_PREFIX and an invalid log level. */ private static String levelToStringSpecialCase(int levelWithFlags) { if((levelWithFlags & SECURITY_LOGGING_FLAG) != 0) { //We know the flag is set so XOR will zero it out. int level = levelWithFlags ^ SECURITY_LOGGING_FLAG; return SecurityLogWriter.SECURITY_PREFIX + levelToString(level); } else { //Needed to prevent infinite recursion //This signifies an unknown log level was used return "level-" + String.valueOf(levelWithFlags); } }
/** * Writes both a message and exception to this writer. * The message level is "severe". * @since 6.0 */ public void severe(StringId msgID, Object param) { severe(msgID, param, null); } /**
/** * Writes both a message and exception to this writer. * The message level is "warning". * @since 6.0 */ public void warning(StringId msgID, Object param) { warning(msgID, param, null); } /**
private ExecutorService getShutdownAllExecutorService(LogWriterI18n logger, int size) { final ThreadGroup thrGrp = LogWriterImpl.createThreadGroup("ShutdownAllGroup", logger); ThreadFactory thrFactory = new ThreadFactory() { private final AtomicInteger threadCount = new AtomicInteger(1); public Thread newThread(Runnable r) { Thread t = new Thread(thrGrp, r, "ShutdownAll-" + threadCount.getAndIncrement()); t.setDaemon(true); return t; } }; ExecutorService es = Executors.newFixedThreadPool(shutdownAllPoolSize == -1 ? size : shutdownAllPoolSize, thrFactory); return es; }
/** * @return true if "fine" log messages are enabled. */ public boolean fineEnabled() { return this.getLevel() <= FINE_LEVEL /* (bug 29581) && !SmHelper._memorySpaceLow() */; } /**
/** * * Resets the log level of the singleton log writer. * */ public static void setLogWriterLevel( String levelName ) { logWriter.setLevel( LogWriterImpl.levelNameToCode( levelName ) ); } /**
/** * * Fetches the current log level of the singleton log writer. * */ public static String getLogWriterLevel() { return LogWriterImpl.levelToString( logWriter.getLevel() ); } /**
/** * Writes a message to this writer. * The message level is "severe". */ public void severe(String msg) { this.severe(msg, null); } /**
/** * Writes both a message and exception to this writer. * The message level is "warning". * @since 6.0 */ public void warning(StringId msgID) { warning(msgID, null, null); } /**