Register some signal handlers.

@param LOG The slf4j logger
4195
public static void register(final Logger LOG) {
		synchronized (SignalHandler.class) {
			if (registered) {
				return;
			}
			registered = true;

			final String[] SIGNALS = OperatingSystem.isWindows()
				? new String[]{ "TERM", "INT"}
				: new String[]{ "TERM", "HUP", "INT" };
			
			StringBuilder bld = new StringBuilder();
			bld.append("Registered UNIX signal handlers for [");
			
			String separator = "";
			for (String signalName : SIGNALS) {
				try {
					new Handler(signalName, LOG);
					bld.append(separator);
					bld.append(signalName);
					separator = ", ";
				} catch (Exception e) {
					LOG.info("Error while registering signal handler", e);
				}
			}
			bld.append("]");
			LOG.info(bld.toString());
		}
	}
1090616
public static void warn(Logger log, String methodName) {
        if (log.isWarnEnabled())
            log.warn(buildMethodLogString(methodName));
    }
754485
protected function registerSignals()
    {
        foreach (self::$signals as $no => $name) {
            if (($name === 'SIGKILL') || ($name == 'SIGSTOP')) {
                continue;
            }

            if (!\pcntl_signal($no, [$this, 'sighandler'], true)) {
                $this->log('Cannot assign ' . $name . ' signal');
            }
        }
    }
1276304
public static void debug(Logger log, String methodName) {
        if (log.isDebugEnabled())
            log.debug(buildMethodLogString(methodName));
    }
777548
protected function registerLogBindings()
  {
    $this->singleton('Psr\Log\LoggerInterface', function () {
      $name = Str::slug($this->getNamespaceName());
      if ($this->monologConfigurator) {
        return call_user_func($this->monologConfigurator, new Logger($name));
      } else {
        return new Logger($name, [$this->getMonologHandler()]);
      }
    });
  }
398381
def register_signals(self, app):
        """"""
        before_record_index.connect(inject_provisional_community)
        if app.config['COMMUNITIES_OAI_ENABLED']:
            listen(Community, 'after_insert', create_oaipmh_set)
            listen(Community, 'after_delete', destroy_oaipmh_set)
        inclusion_request_created.connect(new_request)
1228277
public static void hijackJDKLogging() {
        JUL_HIJACKING_LOCK.lock();
        try {
            if (!julHijacked) {
                SLF4JBridgeHandler.removeHandlersForRootLogger();
                SLF4JBridgeHandler.install();
                julHijacked = true;
            }
        } finally {
            JUL_HIJACKING_LOCK.unlock();
        }
    }
1229561
public synchronized void registerSignal(int signalNumber, Runnable callback, boolean replace) {
        String signalName = signalMap.get(signalNumber);
        if (signalName == null) {
            LOG.warn("Invalid signalNumber " + signalNumber);
            return;
        }

        LOG.info("Begin to register signal of {}", signalName);
        try {
            SignalHandler oldHandler = Signal.handle(new Signal(signalName), this);
            LOG.info("Successfully register {} handler", signalName);

            Runnable old = signalHandlers.put(signalNumber, callback);
            if (old != null) {
                if (!replace) {
                    oldSignalHandlers.put(signalNumber, oldHandler);

                } else {
                    LOG.info("Successfully old {} handler will be replaced", signalName);
                }

            }
            LOG.info("Successfully register signal of {}", signalName);
        } catch (Exception e) {
            LOG.error("Failed to register " + signalName + ":" + signalNumber + ", Signal already used by VM or OS: SIGILL");
        }

    }
99229
public void log() {
    if (logger != null) {
      if (registry != null) {
        if (isClient()) {
          recordClientMetrics();
        } else {
          recordServerMetrics();
        }
      }
      if (inflightId != null) {
        logger.inflightRequests(inflightId).decrementAndGet();
      }

      logger.log(this);
    } else {
      reset();
    }
  }
682678
def register_logger(self, logger):
        
        handler = CommandHandler(self)
        handler.setFormatter(CommandFormatter())
        logger.handlers = [handler]
        logger.propagate = False

        output = self.output
        level = logging.WARNING
        if output.is_debug():
            level = logging.DEBUG
        elif output.is_very_verbose() or output.is_verbose():
            level = logging.INFO

        logger.setLevel(level)
745504
public void log(Logger targetLogger)
    {
        Object[] argumentArray = getArgumentArray();
        if (getArgumentArray() == null) {
            log(targetLogger, getLevel(), getMarker(), getMessage(), getThrowable());
        } else {
            if (getThrowable() != null) {
                argumentArray = ArrayUtils.add(getArgumentArray(), getThrowable());
            }

            log(targetLogger, getLevel(), getMarker(), getMessage(), argumentArray);
        }
    }
600056
public static final void setJavolutionLogLevel(org.slf4j.Logger log) {
    // disable Javolution info-level logging
    if (log.isTraceEnabled()) {
      javolution.context.LogContext.enter().setLevel(LogContext.Level.DEBUG);
    } else if (log.isDebugEnabled()) {
      javolution.context.LogContext.enter().setLevel(LogContext.Level.DEBUG);
    } else if (log.isInfoEnabled()) {
      javolution.context.LogContext.enter().setLevel(LogContext.Level.INFO);
    } else if (log.isWarnEnabled()) {
      javolution.context.LogContext.enter().setLevel(LogContext.Level.WARNING);
    } else if (log.isErrorEnabled()) {
      javolution.context.LogContext.enter().setLevel(LogContext.Level.ERROR);
    } else {
      javolution.context.LogContext.enter().setLevel(LogContext.Level.FATAL);
    }
  }
1121899
public void registerCommandHandler(String key, CommandHandler handler) {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "registerCommandHandler", new Object[] { key,
                                                                    handler });

        // Add handler to table
        // Note that if there was already a handler with this key it's table
        // entry will
        // be overwritten
        synchronized (_registeredHandlers) {
            _registeredHandlers.put(key, handler);
        }

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "registerCommandHandler");
    }
189176
public static void registerMavenLogger(Log innerLogger) {
		if (INSTANCE == null) {
			INSTANCE = new MavenLoggerFactory(innerLogger);
		}

		if (INSTANCE.innerLogger != innerLogger) {
			throw new IllegalArgumentException(
					"You've previously register a org.apache.maven.plugin.logging.Log that is NOT the one that you're passing !");
		}
	}
1179582
private void onInsert(EventLog log)
    {
        if (insertEvents == null)
        {
            insertEvents = new ConcurrentHashMap<Object, EventLog>();
        }

        insertEvents.put(log.getEntityId(), log);

    }
1184730
@Override
  public void emitted(Map<String, Object>log)  {
    if (socket == null) return;

    ByteArrayOutputStream messageBuffer = new ByteArrayOutputStream(1024);
    Writer messageWriter = null;
    try {
      messageWriter = new OutputStreamWriter(messageBuffer, "utf-8");
      JsonWriter jsonWriter = new JsonWriter(messageWriter);
      jsonWriter.write(log);
      messageWriter.write("\n");
    } catch (IOException e) {
      throw new InternalSpockError(e);
    } finally {
      IoUtil.closeQuietly(messageWriter);
    }

    ByteArrayOutputStream sizeBuffer = new ByteArrayOutputStream();
    Writer sizeWriter = null;
    try {
      sizeWriter = new OutputStreamWriter(sizeBuffer, "utf-8");
      sizeWriter.write(String.valueOf(messageBuffer.size()));
      sizeWriter.write("\n");
    } catch (IOException e) {
      throw new InternalSpockError(e);
    } finally {
      IoUtil.closeQuietly(sizeWriter);
    }

    try {
      socket.getOutputStream().write(sizeBuffer.toByteArray());
      socket.getOutputStream().write(messageBuffer.toByteArray());
      socket.getOutputStream().flush();
    } catch (Exception e) {
      IoUtil.closeQuietly(socket);
      socket = null;
      throw new ExtensionException("Error sending data to report server. " +
          "Server address: $reportServerAddress Server port: $reportServerPort", e);
    }
  }
1063794
public void output(Logger log)
    {
        Map<String, Entry> entries = config.getSortedEntries();
        
        if ( entries.isEmpty() )
        {
            return;
        }

        ColumnPrinter printer = build(entries);

        log.debug("Configuration Details");
        for ( String line : printer.generate() )
        {
            log.debug(line);
        }
    }