/* (non-Javadoc)
@see java.util.logging.Logger#logp(java.util.logging.Level, java.lang.String, java.lang.String, java.lang.Throwable, java.util.function.Supplier)
186711
@Override
	public void logp(Level level, String sourceClass, String sourceMethod, Throwable thrown,
			Supplier<String> msgSupplier) {
		
		super.logp(level, sourceClass, sourceMethod, thrown, maskPassword(msgSupplier));
	}
457720
private void log(Level level, String content, Throwable throwable) {
        String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date());
        String log = String.format("[%s] %s [] - %s", level, dateStr, content);
        if(level.isLessSpecificThan(Level.ERROR)
                && level.isMoreSpecificThan(Level.OFF)) {
            System.err.println(log);
        } else {
            System.out.println(log);
        }

        if (throwable != null) {
            throwable.printStackTrace(System.err);
        }
    }
479490
@Override
	public void log(cn.hutool.log.level.Level level, String format, Object... arguments) {
		log(level, null, format, arguments);
	}
1343522
public static void debug(Object source, String message, Throwable t) {
		LoggerFactory.getInstance().log(LoggerLevel.DEBUG, source, message, t);
	}
85383
public void log(Level level, String format, Object... args)
    {
        if (isLoggable(level))
        {
            if (format != null)
            {
                logIt(level, String.format(format, args));
            }
            else
            {
                logIt(level, String.format("%s format == null", level));
            }
        }
    }
1335409
public void f(final String msg, Throwable exception) {
        logMgr.log(tag, LogLevelConst.FATAL, msg, exception);
    }
1223945
@SneakyThrows
    public static <R> Supplier<R> doAndHandle(final Supplier<R> function, final CheckedFunction<Throwable, R> errorHandler) {
        return () -> {
            try {
                return function.get();
            } catch (final Throwable e) {
                LOGGER.warn(e.getMessage(), e);
                try {
                    return errorHandler.apply(e);
                } catch (final Throwable ex) {
                    throw new IllegalArgumentException(ex.getMessage());
                }
            }
        };
    }
126052
public static <T, E extends Exception> Supplier<T> rethrowSupplier(SupplierWithExceptions<T, E> function) throws E {
        return () -> {
            try {
                return function.get();
            } catch (Exception exception) {
                throwAsUnchecked(exception);
                return null;
            }
        };
    }
1211912
public void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2) {
		logIfEnabled(Level.ERROR, throwable, msg, arg0, arg1, arg2, null);
	}
4730
private void log(String callerFQCN, Level level, String msg, Throwable t) {
        // millis and thread are filled by the constructor
        LogRecord record = new LogRecord(level, msg);
        record.setLoggerName(getName());
        record.setThrown(t);
        // Note: parameters in record are not set because SLF4J only
        // supports a single formatting style
        fillCallerData(callerFQCN, record);
        loggerImpl.log(record);
    }
536967
public static void logThreads(final Logger logger, final Level level, final String prefix) {
    logThreads(logger, level, prefix, "\n\t", "\n\t\t");
  }
190946
public static void log(Logger logger,
                           Level level,
                           String message) {
        log(logger, level, message, NO_PARAMETERS);
    }
585129
public void trace(String loggerFqcn, Object message, Object[] params, Throwable t) {
        doLog(Level.TRACE, loggerFqcn, message, params, t);
    }
261542
@Override
    public void debug(String msg, Throwable e) {
        log.logIfEnabled(FQCN, Level.DEBUG, null, msg, e);
    }
1053496
private void logIfEnabled(String callerFQCN, Level level, Throwable throwable, String format, Object[] arguments){
		if(logger.isLoggable(level)){
			LogRecord record = new LogRecord(level, StrUtil.format(format, arguments));
			record.setLoggerName(getName());
			record.setThrown(throwable);
			fillCallerData(callerFQCN, record);
			logger.log(record);
		}
	}
134513
public void logp(Level level, String sourceClass, String sourceMethod,
		String msg, Object params[]) 
	{
			//PK86423 Start
			//int lastParam = params.length-1;
			//if(params.length>0 && params[lastParam] instanceof Throwable){
			//	params[lastParam]=throwableToString((Throwable) params[lastParam]);
			//}
			if(params!=null && params.length>0 && params[params.length-1] instanceof Throwable){
				params[params.length-1]=throwableToString((Throwable) params[params.length-1]);
			}
			//PK86423 End
			delegateLogger.logp(level,sourceClass,sourceMethod,msg,params);
	}
227287
private synchronized void logEvent( int level, String string, Throwable throwable )
    {
        // Check if the event should be logged
        if ( level > _loggingLevel )
        {
            return;
        }

        if ( _logFile != null )
        {
            // No logfile specified, log using servlet context
            PrintWriter pw = null;
            try
            {
                pw = new PrintWriter( new FileWriter( _logFile, true ) );
                pw.println( _servletName + "(" + level + "): " + string );
                if ( throwable != null )
                {
                    throwable.printStackTrace( pw );
                }
                pw.close();
                // Do a return here. An exception will cause a fall through to
                // do _servletContex logging API
                return;
            }
            catch ( IOException ioe )
            {
                /* just ignore */
            }
        }

        // Otherwise, write to servlet context log
        if ( throwable == null )
        {
            _servletContext.log( string );
        }
        else
        {
            _servletContext.log( string, throwable );
        }
    }