Produces a log template which logs something when stopwatch split is longer than threshold.

@param delegateLogger Concrete log template
@param threshold Threshold (in milliseconds), above which logging is enabled
@return Logger
434635
public static SplitThresholdLogTemplate whenSplitLongerThanMilliseconds(LogTemplate<Split> delegateLogger, long threshold) {
		return whenSplitLongerThanNanoseconds(delegateLogger, threshold * SimonClock.NANOS_IN_MILLIS);
	}
449047
public ProxyDataSourceBuilder logSlowQueryBySlf4j(long thresholdTime, TimeUnit timeUnit) {
        return logSlowQueryBySlf4j(thresholdTime, timeUnit, null, null);
    }
733076
public void report(final ThresholdLogSpan span) {
        if (isOverThreshold(span)) {
            if (!overThresholdQueue.offer(span)) {
                LOGGER.debug("Could not enqueue span {} for over threshold reporting, discarding.", span);
            }
        }
    }
1319488
public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, String loggerName) {
        return logSlowQueryByJUL(thresholdTime, timeUnit, null, loggerName);
    }
834716
public static LogRecord create(SitLogger logger, ElementPosition position, TestStep testStep,
            MessagePattern pattern, Object... params) {

        Object[] newParams = new Object[] { testStep.getItemName(), testStep.getLocator() };
        newParams = ArrayUtils.addAll(newParams, params);

        return create(logger, position, testStep, pattern.getPattern(), newParams);
    }
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);
	}
491478
private static String createMessage(final ThresholdAlert alert, final String template) {
        // TODO: message should be encoded to apropriate encoding
        //return alert.getThreshold().getName() + ": " + alert.getOldStatus() + "->" + alert.getNewStatus();
        String message;
        if(!StringUtils.isEmpty(template)) {
            ThresholdAlertTemplate thresholdAlertTemplate = new ThresholdAlertTemplate(alert);
            message = thresholdAlertTemplate.process(template);
        } else {
            message = ThresholdAlertConverter.toPlainText(alert);
        }
        return message;
    }
666917
public OJBLock createIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger)
    {
        OJBLock result = null;
        switch(((Integer) isolationId).intValue())
        {
            case LockManager.IL_READ_UNCOMMITTED:
                result = new ReadUncommittedLock(resourceId, logger);
                break;
            case LockManager.IL_READ_COMMITTED:
                result = new ReadCommitedLock(resourceId, logger);
                break;
            case LockManager.IL_REPEATABLE_READ:
                result = new RepeadableReadsLock(resourceId, logger);
                break;
            case LockManager.IL_SERIALIZABLE:
                result = new SerializeableLock(resourceId, logger);
                break;
            case LockManager.IL_OPTIMISTIC:
                throw new LockRuntimeException("Optimistic locking must be handled on top of this class");
            default:
                throw new LockRuntimeException("Unknown lock isolation level specified");
        }
        return result;
    }
1161848
public ProxyDataSourceBuilder logSlowQueryBySlf4j(long thresholdTime, TimeUnit timeUnit, String loggerName) {
        return logSlowQueryBySlf4j(thresholdTime, timeUnit, null, loggerName);
    }
754186
public ProxyDataSourceBuilder logSlowQueryBySlf4j(long thresholdTime, TimeUnit timeUnit, SLF4JLogLevel logLevel) {
        return logSlowQueryBySlf4j(thresholdTime, timeUnit, logLevel, null);
    }
523255
public static <T> Iterator<T> weakeningIterator(
        final Iterator<? extends T> delegate)
    {
        Objects.requireNonNull(delegate, "The delegate is null");
        return new Iterator<T>()
        {
            @Override
            public boolean hasNext()
            {
                return delegate.hasNext();
            }
    
            @Override
            public T next()
            {
                return delegate.next();
            }
    
            @Override
            public void remove()
            {
                delegate.remove();
            }
        };
    }
1114736
@Override
    public Filter<E> build(Level threshold) {
        return new Filter<E>() {
            @Override
            public FilterReply decide(E event) {
                return FilterReply.NEUTRAL;
            }
        };
    }
515839
public static void endWithSlowLog(Logger logger, String key, long threshold) {
		slowLog(logger, key, end(key), threshold);
	}
279191
public synchronized static void enableLogging() {
        if (SplitlogLoggerFactory.state == SplitlogLoggingState.ON) {
            return;
        }
        SplitlogLoggerFactory.messageCounter.set(0);
        SplitlogLoggerFactory.state = SplitlogLoggingState.ON;
        /*
         * intentionally using the original logger so that this message can not
         * be silenced
         */
        LoggerFactory.getLogger(SplitlogLoggerFactory.class).info("Forcibly enabled Splitlog's internal logging.");
    }
69095
@SuppressWarnings("UnusedParameters")
	protected LogTemplate<Split> createLogTemplate(Stopwatch stopwatch) {
		LogTemplate<Split> logTemplate;
		if (logEnabled) {
			logTemplate = everyNSeconds(enabledStopwatchLogTemplate, 60);
		} else {
			logTemplate = disabled();
		}
		return logTemplate;
	}
637320
private void prepareLogger(String verboseLog) {
        final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton();
        final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory();

        final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
        encoder.setPattern("%d %C:%L%n%-5level - %msg%n");
        encoder.setContext(context);
        encoder.start();
        final FileAppender<ILoggingEvent> fa = new FileAppender<>();
        fa.setAppend(true);
        fa.setEncoder(encoder);
        fa.setContext(context);
        fa.setFile(verboseLog);
        final File f = new File(verboseLog);
        String name = f.getName();
        final int i = name.lastIndexOf('.');
        if (i > 1) {
            name = name.substring(0, i);
        }
        fa.setName(name);
        fa.start();
        final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
        rootLogger.setLevel(Level.DEBUG);
        final ThresholdFilter filter = new ThresholdFilter();
        filter.setLevel(LogLevel.INFO.getValue());
        filter.setContext(context);
        filter.start();
        rootLogger.iteratorForAppenders().forEachRemaining(action -> {
            action.addFilter(filter);
        });
        rootLogger.addAppender(fa);
    }
868088
public ProxyDataSourceBuilder logSlowQueryToSysOut(long thresholdTime, TimeUnit timeUnit) {
        this.createSysOutSlowQueryListener = true;
        this.slowQueryThreshold = thresholdTime;
        this.slowQueryTimeUnit = timeUnit;
        return this;
    }