/* (non-Javadoc)
@see java.util.logging.Logger#logrb(java.util.logging.Level, java.lang.String, java.lang.String, java.util.ResourceBundle, java.lang.String, java.lang.Object[])
348239
@Override
	public void logrb(Level level, String sourceClass, String sourceMethod, ResourceBundle bundle, String msg,
			Object... params) {
		
		super.logrb(level, sourceClass, sourceMethod, bundle, maskPassword(msg), params);
	}
690594
public void setLoggerLevel(@Nonnull String loggerName, @Nullable String level) {
        logger.info("setLoggerLevel(" + loggerName + "," + level + ")");
        try {
            Level levelAsObject = Level.toLevel(level);
            LogManager.getLogger(loggerName).setLevel(levelAsObject);
        } catch (RuntimeException e) {
            logger.warn("Exception setting logger " + loggerName + " to level " + level, e);
            throw e;
        }
    }
585000
public void logf(Level level, String format, Object... params) {
        doLogf(level, FQCN, format, params, null);
    }
1130013
public static void log(Logger logger,
                           Level level,
                           String message,
                           Object parameter) {
        log(logger, level, message, new Object[] { parameter });
    }
563079
@Override
    public void log(LogRecord logRecord) {
        if (logRecord == null) {
            return;
        }

        Filter f = getFilter();
        if (isLoggable(logRecord.getLevel()) && (f == null || f.isLoggable(logRecord))) {

            // LogRecord computes sourceClassName and sourceMethodName as the
            // caller to Logger.log method. WsLogger is the caller of Logger.log. We
            // don't want to be identified as the caller, so we call getSourceClassName
            // here before calling Logger.log. If sourceClassName is floating,
            // this will set it to null.
            logRecord.getSourceClassName();
            super.log(logRecord);
        }
    }
1199301
@Override
    public void logp(Level level, String sourceClass, String sourceMethod, String msg) {
        if (isLoggable(level)) {
            LogRecord logRecord = createLogRecord(level, msg, null, sourceClass, sourceMethod, null, null);
            log(logRecord);
        }
    }
9976
@Override
    protected void logImpl(LogLevel level,Object[] message,Throwable throwable)
    {
        //format log message
        String text=this.formatLogMessage(level,message,throwable);
        
        //print text to system out
        System.out.println(text);
    }
1209620
public static void addDeepLogger(Object object, Level level)
    {
        addDeepLogger(object, m -> logger.log(level, m));
    }
1048391
public void log(Level level, Object... elements) {
		if(willWrite.compareTo(level)<=0) {
			StringBuilder sb = buildLine(level, new StringBuilder(),elements);
			if(context==null) {
				System.out.println(sb.toString());
			} else {
				context.log(sb.toString());
			}
		}
	}
496357
@SuppressWarnings("PMD.UnusedPrivateMethod")
    private static void log(final int level,
                            @NonNull final String messageFormat,
                            @Nullable final Object... args) {
        if (shouldLog(level)) {
            Log.println(level, TAG, String.format(messageFormat, args));
        }
    }
538093
static public String fromLevel(int level, int length) {
        StringBuffer sb = new StringBuffer(length > 7 ? length : 7);
        switch (level) {
        case LogService.LOG_INFO:
            sb.append("info");
            break;
        case LogService.LOG_DEBUG:
            sb.append("debug");
            break;
        case LogService.LOG_WARNING:
            sb.append("Warning");
            break;
        case LogService.LOG_ERROR:
            sb.append("ERROR");
            break;
        case 0:
            sb.append("DEFAULT");
            break;
        default:
            sb.append("[");
            sb.append(level);
            sb.append("]");
        }
        for (int i = sb.length(); i < length; i++) {
            sb.append(" ");
        }
        return sb.toString();
    }
380949
private void initXlog() {
    LogConfiguration config = new LogConfiguration.Builder()
        .logLevel(BuildConfig.DEBUG ? LogLevel.ALL             // Specify log level, logs below this level won't be printed, default: LogLevel.ALL
            : LogLevel.NONE)
        .tag(getString(R.string.global_tag))                   // Specify TAG, default: "X-LOG"
        // .t()                                                // Enable thread info, disabled by default
        // .st(2)                                              // Enable stack trace info with depth 2, disabled by default
        // .b()                                                // Enable border, disabled by default
        // .jsonFormatter(new MyJsonFormatter())               // Default: DefaultJsonFormatter
        // .xmlFormatter(new MyXmlFormatter())                 // Default: DefaultXmlFormatter
        // .throwableFormatter(new MyThrowableFormatter())     // Default: DefaultThrowableFormatter
        // .threadFormatter(new MyThreadFormatter())           // Default: DefaultThreadFormatter
        // .stackTraceFormatter(new MyStackTraceFormatter())   // Default: DefaultStackTraceFormatter
        // .borderFormatter(new MyBoardFormatter())            // Default: DefaultBorderFormatter
        // .addObjectFormatter(AnyClass.class,                 // Add formatter for specific class of object
        //     new AnyClassObjectFormatter())                  // Use Object.toString() by default
        .addInterceptor(new BlacklistTagsFilterInterceptor(    // Add blacklist tags filter
            "blacklist1", "blacklist2", "blacklist3"))
        // .addInterceptor(new WhitelistTagsFilterInterceptor( // Add whitelist tags filter
        //     "whitelist1", "whitelist2", "whitelist3"))
        // .addInterceptor(new MyInterceptor())                // Add a log interceptor
        .build();

    Printer androidPrinter = new AndroidPrinter();             // Printer that print the log using android.util.Log
    Printer filePrinter = new FilePrinter                      // Printer that print the log to the file system
        .Builder(new File(Environment.getExternalStorageDirectory(), "xlogsample").getPath())       // Specify the path to save log file
        .fileNameGenerator(new DateFileNameGenerator())        // Default: ChangelessFileNameGenerator("log")
        // .backupStrategy(new MyBackupStrategy())             // Default: FileSizeBackupStrategy(1024 * 1024)
        // .cleanStrategy(new FileLastModifiedCleanStrategy(MAX_TIME))     // Default: NeverCleanStrategy()
        .flattener(new ClassicFlattener())                     // Default: DefaultFlattener
        .build();

    XLog.init(                                                 // Initialize XLog
        config,                                                // Specify the log configuration, if not specified, will use new LogConfiguration.Builder().build()
        androidPrinter,                                        // Specify printers, if no printer is specified, AndroidPrinter(for Android)/ConsolePrinter(for java) will be used.
        filePrinter);

    // For future usage: partial usage in MainActivity.
    globalFilePrinter = filePrinter;
  }
549921
public boolean isLoggable(Logger logger, Level l, String str) {
        boolean rs = logger.isLoggable(l) && l.intValue() >= this.logLevel;
        if (this.excludeLogLevels == null || !rs || str == null) return rs;
        String[] keys = this.excludeLogLevels.get(l.intValue());
        if (keys == null) return rs;
        for (String key : keys) {
            if (str.contains(key)) return false;
        }
        return rs;
    }
577495
public void setLevel(String logger, Level level) {
      Logger log = getLogger(logger);
      log.setLevel(level);
      for (String loggerName : getLoggerNames()) {
         if (loggerName.startsWith(logger) && !loggerName.equals(logger)) {
            getLogger(loggerName).setLevel(level);
         }
      }
   }
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 );
        }
    }
694764
public void log(Level level, String loggerFqcn, Object message, Throwable t) {
        doLog(level, loggerFqcn, message, null, t);
    }