Forces the <code>LoggingTool</code> to configure the Log4J toolkit.
Normally this should be done by the application that uses the CDK library,
but is available for convenience.
187815
public static void configureLog4j() {
        LoggingTool localLogger = new LoggingTool(LoggingTool.class);
        try { // NOPMD
            org.apache.log4j.PropertyConfigurator.configure(LoggingTool.class
                    .getResource("/org/openscience/cdk/config/data/log4j.properties"));
        } catch (NullPointerException e) { // NOPMD
            localLogger.error("Properties file not found: ", e.getMessage());
            localLogger.debug(e);
        } catch (Exception e) {
            localLogger.error("Unknown error occurred: ", e.getMessage());
            localLogger.debug(e);
        }
    }
545083
public static void configure(String xmlConfig, File voltroot) {
        try {
            Class<?> loggerClz = Class.forName("org.voltcore.logging.VoltLog4jLogger");
            assert(loggerClz != null);
            Method configureMethod = loggerClz.getMethod("configure", String.class, File.class);
            configureMethod.invoke(null, xmlConfig, voltroot);
        } catch (Exception e) {}
    }
1323229
public static void configureNoLogging() {
    final Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    final LoggerContext context = rootLogger.getLoggerContext();

    // Clear context, removing all appenders
    context.reset();

    // Set logging level to OFF
    for (final Logger logger : context.getLoggerList()) {
      if (logger != rootLogger) {
        logger.setLevel(null);
      }
    }
    rootLogger.setLevel(OFF);
  }
1276639
private void configureWithWrapperWritingToFile(LoggerContext ctx) {
    // configure all logs (ie. root logger) to be written to console with formatting
    // in practice, this will be only APP's own logs as logs from sub processes are written to LOGGER_GOBBLER and
    // LOGGER_GOBBLER is configured below to be detached from root
    // logs are written to the console because we want them to be in sonar.log and the wrapper will write any log
    // from APP's System.out and System.err to sonar.log
    Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
    rootLogger.addAppender(createAppConsoleAppender(ctx, helper.buildLogPattern(APP_ROOT_LOGGER_CONFIG)));

    // in regular configuration, sub processes are not copying their logs to their System.out, so, the only logs to be
    // expected in LOGGER_GOBBLER are those before logback is setup in subprocesses or when JVM crashes
    // so, they must be printed to App's System.out as is (as they are already formatted) and the wrapper will write
    // them to sonar.log
    // logger is configured to be non additive as we don't want these logs written to sonar.log and duplicated in the
    // console with an incorrect formatting
    configureGobbler(ctx);
  }
130846
@Override
    public Configuration<?> configure() throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "configure");
        }

        Configuration<?> configuration = null;
        Class<? extends ValidationProvider<?>> clazz = this.getDefaultProviderClass();
        if (clazz == null) {
            // get configuration object from default provider.
            configuration = Validation.byDefaultProvider().configure();

        } else {
            @SuppressWarnings("unchecked")
            ProviderSpecificBootstrap<?> providerBootstrap = Validation.byProvider((Class) clazz);
            configuration = providerBootstrap.configure();
        }

        setMessageInterpolator(configuration);
        setTraversableResolver(configuration);
        setConstraintValidatorFactory(configuration);
        setConstraintMappings(configuration);
        setProperties(configuration);

        // Indicate to the provider configuration that xml should be ignored. We do this
        // because we need to find the correct xml's for each module, as the provider doesn't
        // guarantee this in an EE environment.
        configuration.ignoreXmlConfiguration();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "configure", configuration);
        }

        return configuration;
    }
237485
def _configure_logging(verbose=False, debug=False):
    """"""
    overall_level = logging.DEBUG if debug else logging.INFO
    logging.basicConfig(
        format=('{levelname[0]}{asctime}.{msecs:03.0f} {thread} '
                '{filename}:{lineno}] {message}'),
        datefmt='%m%d %H:%M:%S',
        style='{',
        level=overall_level)
    global log
    log = logging.getLogger('portserver')
    # The verbosity controls our loggers logging level, not the global
    # one above. This avoids debug messages from libraries such as asyncio.
    log.setLevel(logging.DEBUG if verbose else overall_level)
287360
protected void forcedLog(Marker marker, String fqcn, Priority level, Object message, Throwable t) {
		callAppenders(new FoundationLof4jLoggingEvent(marker, fqcn, this, level, message, t));
	}
833051
public void setLogTargetConfigurations(java.util.Collection<LogTargetConfiguration> logTargetConfigurations) {
        if (logTargetConfigurations == null) {
            this.logTargetConfigurations = null;
            return;
        }

        this.logTargetConfigurations = new java.util.ArrayList<LogTargetConfiguration>(logTargetConfigurations);
    }
1075116
protected void configure() {
		String className = AsyncFileLogger.class.getName();
		ClassLoader cl = Thread.currentThread().getContextClassLoader();

		// Get configured log directory
		directory = getProperty(className + ".directory", "");
		if (directory.isEmpty()) {
			directory = getProperty("moleculer.log.directory", "");
		}

		// Automatic directory selection
		// services.moleculer.logger.AsyncFileLogger.directory = #AUTO
		if (directory.startsWith("#")) {
			String found = null;

			// Detect by "catalina.home" System Property
			String path = System.getProperty("catalina.home");
			if (path != null && path.length() > 0) {
				File test = new File(path, "logs");
				if (test.isDirectory()) {
					found = test.getAbsolutePath();
				}
			}

			// Detect by classpath
			if (found == null) {

				// Lehetséges útvonalak
				HashSet<String> paths = new HashSet<String>();
				paths.add("/moleculer");
				paths.add("/Program Files/moleculer");
				paths.add("/Program Files (x86)/moleculer");
				paths.add("/opt/moleculer");

				String cp = System.getProperty("java.class.path");
				if (paths != null) {
					String pathSeparator = System.getProperty("path.separator");
					if (pathSeparator == null || pathSeparator.length() == 0) {
						pathSeparator = ";:";
					}
					StringTokenizer st = new StringTokenizer(cp, pathSeparator);
					while (st.hasMoreTokens()) {
						path = st.nextToken().trim();
						if (path.length() > 0) {
							path = path.replace('\\', '/');
							int index = path.lastIndexOf('/');
							if (index > -1) {
								path = path.substring(0, index);
							}
							paths.add(path);
						}
					}
				}
				for (String test : paths) {
					found = findLogDirectory(new File(test));
					if (found != null) {
						found = found.replace('\\', '/');
						break;
					}
				}
			}
			if (found == null) {
				found = System.getProperty("user.home", "") + "/logs";
			}
			directory = found;
		}

		if (directory.isEmpty()) {
			logDirectory = null;
		} else {
			logDirectory = new File(directory);
			if (!logDirectory.isDirectory()) {
				logDirectory.mkdirs();
			}
		}

		if (prefix == null) {
			prefix = getProperty(className + ".prefix", "moleculer-");
		}

		// Set 'compress after days' property
		String day = getProperty(className + ".compressAfter", "");
		if (!day.isEmpty()) {
			if (!day.endsWith("days")) {
				throw new IllegalArgumentException("The \"compressAfter\" must be in days (eg. \"14 days\")!");
			}
			compressAfterDays = Integer.parseInt(day.substring(0, day.length() - 4).trim());
		}

		// Set "delete after days" property
		day = getProperty(className + ".deleteAfter", "");
		if (!day.isEmpty()) {
			if (!day.endsWith("days")) {
				throw new IllegalArgumentException("The \"deleteAfter\" must be in days (eg. \"14 days\")!");
			}
			deleteAfterDays = Integer.parseInt(day.substring(0, day.length() - 4).trim());
			if (deleteAfterDays < compressAfterDays || compressAfterDays < 2 || deleteAfterDays < 2) {
				throw new IllegalArgumentException("Invalid values (delete logs after " + deleteAfterDays
						+ " days, compress logs after " + compressAfterDays + " days)!");
			}
		}

		// Set formatter
		String formatterName = getProperty(className + ".formatter", null);
		if (formatterName != null && !formatterName.isEmpty()) {
			try {
				setFormatter((Formatter) cl.loadClass(formatterName).newInstance());
			} catch (Exception ignored) {
			}
		}
		if (getFormatter() == null) {
			setFormatter(new FastLogFormatter());
		}

		// Set file encoding
		fileEncoding = getProperty(className + ".encoding", "UTF8");

		// Log to console
		logToConsole = Boolean.parseBoolean(getProperty(className + ".logToConsole", "false"));

		// Enable colors
		enableColors = Boolean.parseBoolean(getProperty(className + ".enableColors", "true"));

		// Set level
		setLevel(Level.parse(getProperty(className + ".level", Level.INFO.toString())));

		// Print log directory
		if (logDirectory != null) {
			try {
				LogRecord record = new LogRecord(Level.INFO,
						"Directory of log files: " + logDirectory.getCanonicalPath());
				record.setSourceClassName(AsyncFileLogger.class.getName());
				publish(record);
			} catch (Exception cause) {
				cause.printStackTrace();
			}
		}
	}
108994
public void configure(Properties props) {
        this.refreshCount.set(0);
        this.overrideProps.clear();
        
        this.originalAsyncAppenderNameMap.clear();
       // First try to load the log4j configuration file from the classpath
        String log4jConfigurationFile = System.getProperty(PROP_LOG4J_CONFIGURATION);
        
        NFHierarchy nfHierarchy = null;
        
        // Make log4j use blitz4j implementations
        if ((!NFHierarchy.class.equals(LogManager.getLoggerRepository().getClass()))) {
            nfHierarchy = new NFHierarchy(new NFRootLogger(org.apache.log4j.Level.INFO));
            org.apache.log4j.LogManager.setRepositorySelector(new NFRepositorySelector(nfHierarchy), guard);
        }
        
        String log4jLoggerFactory = System.getProperty(PROP_LOG4J_LOGGER_FACTORY);
        if (log4jLoggerFactory != null) {
            this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, log4jLoggerFactory);
            if (nfHierarchy != null) {
                try {
                    LoggerFactory loggerFactory = (LoggerFactory) Class.forName(log4jLoggerFactory).newInstance();
                    nfHierarchy.setLoggerFactory(loggerFactory);
                } catch (Exception e) {
                    System.err.println("Cannot set the logger factory. Hence reverting to default.");
                    e.printStackTrace();
                }
            }
        } else {
            this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, BLITZ_LOGGER_FACTORY);

        }
        if (log4jConfigurationFile != null) {
            loadLog4jConfigurationFile(log4jConfigurationFile);
            // First configure without async so that we can capture the output
            // of dependent libraries
            clearAsyncAppenderList();
            PropertyConfigurator.configure(this.initialProps);
        }

        this.blitz4jConfig = new DefaultBlitz4jConfig(props);

        if ((log4jConfigurationFile == null) && (blitz4jConfig.shouldLoadLog4jPropertiesFromClassPath())) {
            try {
                URL url = Loader.getResource(LOG4J_PROPERTIES);
                if (url != null) {
                    try (InputStream in = url.openStream()) {
                        this.initialProps.load(in);
                    }
                }
            } catch (Exception t) {
                System.err.println("Error loading properties from " + LOG4J_PROPERTIES);
            } 
        }   
        
        Enumeration enumeration = props.propertyNames();
        while (enumeration.hasMoreElements()) {
            String key = (String) enumeration.nextElement();
            String propertyValue = props.getProperty(key);
            this.initialProps.setProperty(key, propertyValue);
        }
        
        this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps);
    
        String[] asyncAppenderArray = blitz4jConfig.getAsyncAppenders();
        if (asyncAppenderArray == null) {
            return;
        }
        for (int i = 0; i < asyncAppenderArray.length; i++) {
            String oneAppenderName = asyncAppenderArray[i];
            if ((i == 0) || (oneAppenderName == null)) {
                continue;
            }
            oneAppenderName = oneAppenderName.trim();
            String oneAsyncAppenderName = oneAppenderName + ASYNC_APPENDERNAME_SUFFIX;
            originalAsyncAppenderNameMap.put(oneAppenderName, oneAsyncAppenderName);
        }
        try {
            convertConfiguredAppendersToAsync(this.initialProps);
        } catch (Exception e) {
            throw new RuntimeException("Could not configure async appenders ",
                    e);
        }
        // Yes second time init required as properties would have been during async appender conversion
        this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps);
        clearAsyncAppenderList();
        PropertyConfigurator.configure(this.initialProps);
        closeNonexistingAsyncAppenders();
        this.logger = org.slf4j.LoggerFactory.getLogger(LoggingConfiguration.class);
        ConfigurationManager.getConfigInstance().addConfigurationListener(
                new ExpandedConfigurationListenerAdapter(this));
    }
949212
public void configure(Configuration config) throws ConfigurationException
    {
        LoggingConfiguration lc = (LoggingConfiguration) config;
        String levelName = lc.getLogLevel(name);
        setLevel(levelName);
    }
22012
private void updateConfiguration( BundleContext bundleContext,
                                      final String pattern )
        throws IOException
    {
        final ConfigurationAdmin configAdmin = getConfigurationAdmin( bundleContext );
        final Configuration configuration = configAdmin.getConfiguration( "org.ops4j.pax.logging", null );

        final Hashtable<String, Object> log4jProps = new Hashtable<String, Object>();
        log4jProps.put( "log4j.rootLogger", "DEBUG, CONSOLE" );
        log4jProps.put( "log4j.appender.CONSOLE", "org.apache.log4j.ConsoleAppender" );
        log4jProps.put( "log4j.appender.CONSOLE.layout", "org.apache.log4j.PatternLayout" );
        log4jProps.put( "log4j.appender.CONSOLE.layout.ConversionPattern", pattern );

        configuration.update( log4jProps );
    }
1175048
@Override
  protected void configure() {
    try {
      InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
      File appRoot = new File(System.getProperty(CadmiumListener.BASE_PATH_ENV), "maven");
      FileUtils.forceMkdir(appRoot);
      String remoteMavenRepo = System.getProperty(MAVEN_REPOSITORY);
      ArtifactResolver resolver = new ArtifactResolver(remoteMavenRepo, appRoot.getAbsolutePath());
      bind(ArtifactResolver.class).toInstance(resolver);
      bind(JBossAdminApi.class);
      Multibinder<ConfigurationListener> listenerBinder = Multibinder.newSetBinder(binder(), ConfigurationListener.class);
      listenerBinder.addBinding().to(JBossAdminApi.class);
      bind(IJBossUtil.class).to(JBossDelegator.class);
    } catch(Exception e) {
      logger.error("Failed to initialize maven artifact resolver.", e);
    }
  }
1290620
private static LoggingProvider loadLoggingProvider() {
		ServiceLoader<LoggingProvider> loader = new ServiceLoader<LoggingProvider>(LoggingProvider.class);
		String name = Configuration.get(PROVIDER_PROPERTY);

		if (name == null) {
			Collection<LoggingProvider> providers = loader.createAll();
			switch (providers.size()) {
				case 0:
					InternalLogger.log(Level.WARN, "No logging framework implementation found in classpath."
						+ " Add tinylog-impl.jar for outputting log entries.");
					return new NopLoggingProvider();
				case 1:
					return providers.iterator().next();
				default:
					return new BundleLoggingProvider(providers);
			}
		} else if (NOP_PROVIDER_NAME.equalsIgnoreCase(name)) {
			return new NopLoggingProvider();
		} else {
			LoggingProvider provider = loader.create(name);
			if (provider == null) {
				InternalLogger.log(Level.ERROR, "Requested logging provider is not available. Logging will be disabled.");
				return new NopLoggingProvider();
			} else {
				return provider;
			}
		}
	}
1214093
private void configureConsole(LoggerContext loggerContext) {
    ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(loggerContext, CONSOLE_PLAIN_APPENDER, "%msg%n");

    Logger consoleLogger = loggerContext.getLogger(CONSOLE_LOGGER);
    consoleLogger.setAdditive(false);
    consoleLogger.addAppender(consoleAppender);
  }
1041059
private void initializeLogging() {
		// Since logging is static, make sure this is done only once even if
		// multiple clients are created (e.g., during tests)
		if (consoleAppender != null) {
			return;
		}

		consoleAppender = new ConsoleAppender();
		consoleAppender.setLayout(new PatternLayout(LOG_PATTERN));
		consoleAppender.setThreshold(Level.INFO);
		LevelRangeFilter filter = new LevelRangeFilter();
		filter.setLevelMin(Level.TRACE);
		filter.setLevelMax(Level.INFO);
		consoleAppender.addFilter(filter);
		consoleAppender.activateOptions();
		org.apache.log4j.Logger.getRootLogger().addAppender(consoleAppender);

		errorAppender = new ConsoleAppender();
		errorAppender.setLayout(new PatternLayout(LOG_PATTERN));
		errorAppender.setThreshold(Level.WARN);
		errorAppender.setTarget(ConsoleAppender.SYSTEM_ERR);
		errorAppender.activateOptions();
		org.apache.log4j.Logger.getRootLogger().addAppender(errorAppender);
	}
38483
def configure_parser(self, parser):
        
        parser.add_argument("--log_path", default="", help="The log file path")
        parser.add_argument("--verbose", help="Increase logging verbosity", action="store_true")