Creates an output port logger for the given type.

@param clazz The type being logged.
@param output The output to which to log messages.
@return An output port logger.
503864
public static PortLogger getLogger(Class<?> clazz, OutputCollector output) {
    return getLogger(clazz.getCanonicalName(), output);
  }
636872
public static final void loge(Class<?> clazz, String msg, Exception... e) {
        if (DEBUG) {

            String exceptionStr = "";

            if (e != null && e.length == 1) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e[0].printStackTrace(pw);
                pw.flush();
                exceptionStr = "exception = " + sw.toString();
            }
            System.err.println("[" + sSdf.format(new Date()) + "]" + "-" + "[" + clazz.getSimpleName() + "] " + msg + " " + exceptionStr);
        }
    }
515976
public static Logger getInstance(Class loggerClient) {
        return new Logger(org.apache.commons.logging.LogFactory.getLog(loggerClient.getName()));
    }
1067026
private boolean doExecuteMavenEmbedded(final PrintStream out, final PrintStream err, final List<String> list)
   {
      // Have we asked for quiet mode?
      final boolean quiet = list.contains("-q") || list.contains("--quiet");
      final String[] params = list.toArray(new String[list.size()]);
      // Get root logger. Yes, it is an empty logger, Logger.getGlobal() doesn't work here
      final Logger globalLogger = Logger.getLogger(Strings.EMPTY);
      final Handler outHandler = new UncloseableStreamHandler(out, quiet);
      try
      {
         globalLogger.addHandler(outHandler);
         PrintStream oldout = System.out;
         PrintStream olderr = System.err;
         try
         {
            System.setOut(out);
            System.setErr(err);
            CliRequest cliRequest = createCliRequest(params, getFaceted().getRoot().getFullyQualifiedName());
            int returnCode = new MavenCli().doMain(cliRequest);
            return returnCode == 0;
         }
         finally
         {
            System.setOut(oldout);
            System.setErr(olderr);
         }
      }
      finally
      {
         globalLogger.removeHandler(outHandler);
      }
   }
1044749
public static synchronized void printPortsInUse(VoltLogger log) {
        try {
            /*
             * Don't do DNS resolution, don't use names for port numbers
             */
            ProcessBuilder pb = new ProcessBuilder("lsof", "-i", "-n", "-P");
            pb.redirectErrorStream(true);
            Process p = pb.start();
            java.io.InputStreamReader reader = new java.io.InputStreamReader(p.getInputStream());
            java.io.BufferedReader br = new java.io.BufferedReader(reader);
            String str = br.readLine();
            log.fatal("Logging ports that are bound for listening, " +
                      "this doesn't include ports bound by outgoing connections " +
                      "which can also cause a failure to bind");
            log.fatal("The PID of this process is " + getPID());
            if (str != null) {
                log.fatal(str);
            }
            while((str = br.readLine()) != null) {
                if (str.contains("LISTEN")) {
                    log.fatal(str);
                }
            }
        }
        catch (Exception e) {
            log.fatal("Unable to list ports in use at this time.");
        }
    }
1033459
static Log create(File outputFile) {
    try {
      return new Log(
              new PrintStream(
                 outputFile.getName().endsWith(".gz") ?
                   new GZIPOutputStream(new FileOutputStream(outputFile))
                 : new FileOutputStream(outputFile)),
              false);  
    } 
    catch (IOException e) {
      throw new InvalidOperationException("I/O error", e);
    }
  }
436566
protected function makeConsoleLogger(OutputInterface $output): ConsoleLogger
    {
        return new ConsoleLogger($output, [
            LogLevel::DEBUG  => OutputInterface::VERBOSITY_VERY_VERBOSE,
            LogLevel::INFO   => OutputInterface::VERBOSITY_VERBOSE,
            LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL
        ], [
            LogLevel::DEBUG  => '',
            LogLevel::INFO   => '',
            LogLevel::NOTICE => 'info'
        ]);
    }
268960
def shell_logger(output):
    
    if not os.environ.get('SHELL'):
        logs.warn("Shell logger doesn't support your platform.")
        sys.exit(1)

    fd = os.open(output, os.O_CREAT | os.O_TRUNC | os.O_RDWR)
    os.write(fd, b'\x00' * const.LOG_SIZE_IN_BYTES)
    buffer = mmap.mmap(fd, const.LOG_SIZE_IN_BYTES, mmap.MAP_SHARED, mmap.PROT_WRITE)
    return_code = _spawn(os.environ['SHELL'], partial(_read, buffer))

    sys.exit(return_code)
705659
public Registration writeClass (Output output, Class type) {
		if (output == null) throw new IllegalArgumentException("output cannot be null.");
		try {
			return classResolver.writeClass(output, type);
		} finally {
			if (depth == 0 && autoReset) reset();
		}
	}
593761
@Override
    public IApimanLogger createLogger(Class <?> klazz) {
        delegatedLogger = LogManager.getLogger(klazz);
        this.klazz = klazz;
        return this;
    }
845616
public static InternalLogApi getLog(Class<?> clazz) {
        return factoryConfigured
             ? factory.doGetLog(clazz)
             : new InternalLog(clazz.getName()); // will look up actual logger per log
    }
824458
public static Logger getLogger(final Class<?> clazz) {
        if (!clazz.getPackage().getName().startsWith(LOGGER.getName())) {
            throw new IllegalArgumentException(String.format("Class %s is not a child of the package %s",
                    clazz.getName(), LOGGER.getName()));
        }
        LOGGER.fine(() -> String.format("Locating logger for class %s", clazz));
        return Logger.getLogger(clazz.getName());
    }
425085
public static MjdbcLogger getLogger(Class clazz) {
        MjdbcLogger mjdbcLogger = new MjdbcLogger(clazz.getName(), null);

        if (isSLF4jAvailable() == true) {
            try {
                mjdbcLogger = new MjdbcLogger(clazz.getName(), null);
                mjdbcLogger.setSlfLogger(MappingUtils.invokeStaticFunction(Class.forName("org.slf4j.LoggerFactory"), "getLogger", new Class[]{Class.class}, new Object[]{clazz}));
            } catch (MjdbcException e) {
                setSLF4jAvailable(false);
            } catch (ClassNotFoundException e) {
                setSLF4jAvailable(false);
            }
        }

        return mjdbcLogger;
    }
1114080
public AsyncAnnotationAuditOutputStream write(Class<?> clazz, Method method, Object[] args) {
        AnnotationAuditEvent event = new AnnotationAuditEvent();
        event.setClazz(clazz);
        event.setMethod(method);
        event.setArgs(args);
        annotationDeferred.accept(event);
        b.await();
        return this;
    }
615406
public static function getInstance(OutputInterface $output = null): ConsoleLogger
    {
        if (!isset(self::$logger)) {
            self::$logger = new ConsoleLogger($output);
        }
        return self::$logger;
    }
216968
public void dumpLogBuffer(String identifier)
  {
    final ArrayList<LogRecord> logBufferCopy;
    final PrintWriter logDumper;
    final OutputStream outStream;
    Formatter formatter = this.getFormatter();

    // Check if compression of dump file is enabled
    boolean disableCompression =
        System.getProperty(DISABLE_DUMP_COMPR_PROP) != null;

    // If no identifying factor (eg, an incident id) was provided, get one
    if (identifier == null)
    {
      identifier = EventUtil.getDumpFileId();
    }

    // Do some sanity checking to make sure we're not flooding the user's
    // disk with dump files
    cleanupSfDumps(true);

    String logDumpPath = logDumpPathPrefix + "/" + LOG_DUMP_FILE_NAME +
                         identifier + LOG_DUMP_FILE_EXT;

    if (!disableCompression)
    {
      logDumpPath += LOG_DUMP_COMP_EXT;
    }

    logger.debug("EventHandler dumping log buffer to {}", logDumpPath);

    // Copy logBuffer because this is potentially long running.
    synchronized (this)
    {
      logBufferCopy = new ArrayList<>(logBuffer);
      logBuffer.clear();
    }

    File outputFile = new File(logDumpPath);

    /**
     * Because log files could potentially be very large, we should never open
     * them in append mode. It's rare that this should happen anyways...
     */
    try
    {
      // If the dump path doesn't already exist, create it.
      if (outputFile.getParentFile() != null)
      {
        outputFile.getParentFile().mkdirs();
      }

      outStream = disableCompression ?
                  new FileOutputStream(logDumpPath, false) :
                  new GZIPOutputStream(new FileOutputStream(logDumpPath, false));

      logDumper = new PrintWriter(outStream, true);
    }
    catch (IOException exc)
    {
      // Not much to do here, can't dump logs so exit out.
      logger.debug("Log dump failed, exception: {}", exc.getMessage());

      return;
    }

    // Iterate over log entries, format them, then dump them.
    for (LogRecord entry : logBufferCopy)
    {
      logDumper.write(formatter != null ? formatter.format(entry) :
                      entry.getMessage());
    }

    // Clean up
    logDumper.flush();
    logDumper.close();
  }
810737
public synchronized static Log getLog(Class< ? > clazz)
    {
        if (slf4jLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("org.slf4j.Logger");
                slf4jLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                slf4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (slf4jLoggingAvailable)
        {
            try
            {
                return new Slf4JLogger(clazz);
            }
            catch (Throwable e)
            {
                slf4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (log4jLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("org.apache.log4j.Logger");
                log4jLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                log4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (log4jLoggingAvailable)
        {
            return new Log4JLogger(clazz);
        }

        if (javaLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("java.util.logging.Logger");
                javaLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                javaLoggingAvailable = Boolean.FALSE;
            }
        }
        if (javaLoggingAvailable)
        {
            return new JavaLoggingLog(clazz);
        }
        return new NullLog();
    }