Fixes the Chameleon logging configuration to write the logs in the logs/wisdom.log file instead of chameleon.log
file.

@param basedir the base directory of the chameleon
328964
public static void fixLoggingSystem(File basedir) {
        ILoggerFactory factory = LoggerFactory.getILoggerFactory();
        if (factory instanceof LoggerContext) {
            // We know that we are using logback from here.
            LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
            ch.qos.logback.classic.Logger logbackLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
            if (logbackLogger == null) {
                return;
            }

            Iterator<Appender<ILoggingEvent>> iterator = logbackLogger.iteratorForAppenders();
            while (iterator.hasNext()) {
                Appender<ILoggingEvent> appender = iterator.next();

                if (appender instanceof AsyncAppender) {
                    appender = ((AsyncAppender) appender).getAppender("FILE");
                }

                if (appender instanceof RollingFileAppender) {
                    RollingFileAppender<ILoggingEvent> fileAppender =
                            (RollingFileAppender<ILoggingEvent>) appender;
                    String file = new File(basedir, "logs/wisdom.log").getAbsolutePath();
                    fileAppender.stop();
                    // Remove the created log directory.
                    // We do that afterwards because on Windows the file cannot be deleted while we still have a logger
                    // using it.
                    FileUtils.deleteQuietly(new File("logs"));
                    fileAppender.setFile(file);
                    fileAppender.setContext(lc);
                    fileAppender.start();
                }
            }
        }
    }
877035
public static function init($baseDir = "", $verbose = true) {
		
		// make sure a base dir was supplied
		if (empty($baseDir)) {
			Console::writeError("need a base directory to initialize the config class...");
		}
		
		// normalize the baseDir
		$baseDir = FileUtil::normalizePath($baseDir);
		
		// double-check the default config file exists
		if (!is_dir($baseDir)) {
			Console::writeError("make sure ".$baseDir." exists...");
		}
		
		// set the baseDir option
		self::$options["baseDir"] = ($baseDir[strlen($baseDir)-1] == DIRECTORY_SEPARATOR) ? $baseDir : $baseDir.DIRECTORY_SEPARATOR;
		
		// set-up the paths
		self::$userConfigDirClean  = self::$options["baseDir"].self::$userConfigDirClean;
		self::$userConfigDirDash   = self::$options["baseDir"].self::$userConfigDirDash;
		self::$userConfigDir       = (is_dir(self::$userConfigDirDash)) ? self::$userConfigDirDash : self::$userConfigDirClean;
		self::$userConfigPath      = self::$userConfigDir.DIRECTORY_SEPARATOR.self::$userConfig;
		self::$plConfigPath        = self::$options["baseDir"]."vendor/pattern-lab/core/".self::$plConfigPath;
		
		// can't add __DIR__ above so adding here
		if (!is_dir(self::$userConfigDir)) {
			mkdir(self::$userConfigDir);
		}
		
		// check to see if the user config exists, if not create it
		if ($verbose) {
			Console::writeLine("configuring pattern lab...");
		}
		
		// make sure migrate doesn't happen by default
		$migrate        = false;
		$diffVersion    = false;
		$defaultOptions = array();
		$userOptions    = array();
		
		// double-check the default config file exists
		if (!file_exists(self::$plConfigPath)) {
			Console::writeError("the default options for Pattern Lab don't seem to exist at <path>".Console::getHumanReadablePath(self::$plConfigPath)."</path>. please check on the install location of pattern lab...");
		}
		
		// set the default config using the pattern lab config
		try {
			$defaultOptions = Yaml::parse(file_get_contents(self::$plConfigPath));
			self::$options  = array_merge(self::$options, $defaultOptions);
		} catch (ParseException $e) {
			Console::writeError("Config parse error in <path>".Console::getHumanReadablePath(self::$plConfigPath)."</path>: ".$e->getMessage());
		}
		
		// double-check the user's config exists. if not mark that we should migrate the default one
		if (file_exists(self::$userConfigPath)) {
			try {
				$userOptions   = Yaml::parse(file_get_contents(self::$userConfigPath));
				self::$options = array_merge(self::$options, $userOptions);
			} catch (ParseException $e) {
				Console::writeError("Config parse error in <path>".Console::getHumanReadablePath(self::$userConfigPath)."</path>: ".$e->getMessage());
			}
		} else {
			$migrate = true;
		}
		
		// compare version numbers
		$diffVersion = (isset($userOptions["v"]) && ($userOptions["v"] == $defaultOptions["v"])) ? false : true;
		
		// run an upgrade and migrations if necessary
		if ($migrate || $diffVersion) {
			if ($verbose) {
				Console::writeInfo("upgrading your version of pattern lab...");
			}
			if ($migrate) {
				if (!@copy(self::$plConfigPath, self::$userConfigPath)) {
					Console::writeError("make sure that Pattern Lab can write a new config to ".self::$userConfigPath."...");
					exit;
				}
			} else {
				self::$options = self::writeNewConfigFile(self::$options, $defaultOptions);
			}
		}
		
		// making sure the config isn't empty
		if (empty(self::$options) && $verbose) {
			Console::writeError("a set of configuration options is required to use Pattern Lab...");
			exit;
		}
		
		// set-up the various dirs
		self::$options["configDir"]        = self::$userConfigDir;
		self::$options["configPath"]       = self::$userConfigPath;
		self::$options["coreDir"]          = is_dir(self::$options["baseDir"]."_core") ? self::$options["baseDir"]."_core" : self::$options["baseDir"]."core";
		self::$options["exportDir"]        = isset(self::$options["exportDir"])        ? self::$options["baseDir"].self::cleanDir(self::$options["exportDir"])   : self::$options["baseDir"]."exports";
		self::$options["publicDir"]        = isset(self::$options["publicDir"])        ? self::$options["baseDir"].self::cleanDir(self::$options["publicDir"])   : self::$options["baseDir"]."public";
		self::$options["scriptsDir"]       = isset(self::$options["scriptsDir"])       ? self::$options["baseDir"].self::cleanDir(self::$options["scriptsDir"])  : self::$options["baseDir"]."scripts";
		self::$options["sourceDir"]        = isset(self::$options["sourceDir"])        ? self::$options["baseDir"].self::cleanDir(self::$options["sourceDir"])   : self::$options["baseDir"]."source";
		self::$options["componentDir"]     = isset(self::$options["componentDir"])     ? self::$options["publicDir"].DIRECTORY_SEPARATOR.self::cleanDir(self::$options["componentDir"]) : self::$options["publicDir"].DIRECTORY_SEPARATOR."patternlab-components";
		self::$options["dataDir"]          = isset(self::$options["dataDir"])          ? self::$options["sourceDir"].DIRECTORY_SEPARATOR.self::cleanDir(self::$options["dataDir"]) : self::$options["sourceDir"].DIRECTORY_SEPARATOR."_data";
		self::$options["patternExportDir"] = isset(self::$options["patternExportDir"]) ? self::$options["exportDir"].DIRECTORY_SEPARATOR.self::cleanDir(self::$options["patternExportDir"]) : self::$options["exportDir"].DIRECTORY_SEPARATOR."patterns";
		self::$options["patternPublicDir"] = isset(self::$options["patternPublicDir"]) ? self::$options["publicDir"].DIRECTORY_SEPARATOR.self::cleanDir(self::$options["patternPublicDir"]) : self::$options["publicDir"].DIRECTORY_SEPARATOR."patterns";
		self::$options["patternSourceDir"] = isset(self::$options["patternSourceDir"]) ? self::$options["sourceDir"].DIRECTORY_SEPARATOR.self::cleanDir(self::$options["patternSourceDir"]) : self::$options["sourceDir"].DIRECTORY_SEPARATOR."_patterns";
		self::$options["metaDir"]          = isset(self::$options["metaDir"])          ? self::$options["sourceDir"].DIRECTORY_SEPARATOR.self::cleanDir(self::$options["metaDir"]) : self::$options["sourceDir"].DIRECTORY_SEPARATOR."_meta/";
		self::$options["annotationsDir"]   = isset(self::$options["annotationsDir"])   ? self::$options["sourceDir"].DIRECTORY_SEPARATOR.self::cleanDir(self::$options["annotationsDir"]) : self::$options["sourceDir"].DIRECTORY_SEPARATOR."_annotations/";
		
		// set-up outputFileSuffixes
		self::$options["outputFileSuffixes"]["rendered"]    = isset(self::$options["outputFileSuffixes"]["rendered"])    ? self::$options["outputFileSuffixes"]["rendered"]    : '';
		self::$options["outputFileSuffixes"]["rawTemplate"] = isset(self::$options["outputFileSuffixes"]["rawTemplate"]) ? self::$options["outputFileSuffixes"]["rawTemplate"] : '';
		self::$options["outputFileSuffixes"]["markupOnly"]  = isset(self::$options["outputFileSuffixes"]["markupOnly"])  ? self::$options["outputFileSuffixes"]["markupOnly"]  : '.markup-only';
		
		// handle a pre-2.1.0 styleguideKitPath before saving it
		if (isset(self::$options["styleguideKitPath"])) {
			self::$options["styleguideKitPath"] = self::$options["baseDir"].self::cleanDir(self::getStyleguideKitPath(self::$options["styleguideKitPath"]));
		}
		
		// double-check a few directories are real and set-up
		FileUtil::checkPathFromConfig(self::$options["sourceDir"], self::$userConfigPath, "sourceDir");
		FileUtil::checkPathFromConfig(self::$options["publicDir"], self::$userConfigPath, "publicDir");
		
		// make sure styleguideExcludes is set to an array even if it's empty
		if (is_string(self::$options["styleGuideExcludes"])) {
			self::$options["styleGuideExcludes"] = array();
		}
		
		// set the cacheBuster
		self::$options["cacheBuster"] = (self::$options["cacheBusterOn"] == "false") ? 0 : time();
		
		// provide the default for enable CSS. performance hog so it should be run infrequently
		self::$options["enableCSS"] = false;
		
		// which of these should be exposed in the front-end?
		self::$options["exposedOptions"] = array();
		self::setExposedOption("cacheBuster");
		self::setExposedOption("defaultPattern");
		self::setExposedOption("defaultShowPatternInfo");
		self::setExposedOption("patternExtension");
		self::setExposedOption("ishFontSize");
		self::setExposedOption("ishMaximum");
		self::setExposedOption("ishMinimum");
		self::setExposedOption("ishViewportRange");
		self::setExposedOption("outputFileSuffixes");
		self::setExposedOption("patternStates");
		self::setExposedOption("theme");
		self::setExposedOption("plugins");
		
	}
817768
def _configure_root_logger(self):
        """"""
        root_logger = logging.getLogger()
        root_logger.setLevel(logging.DEBUG)
        if self.args.verbose:
            handler = logging.StreamHandler(sys.stdout)
        else:
            handler = logging.handlers.RotatingFileHandler(
                common.LOG_FILE,
                maxBytes=common.MAX_LOG_SIZE,
                backupCount=common.MAX_LOG_COUNT
            )
            handler.setLevel(logging.INFO)
        handler.setFormatter(logging.Formatter(common.LOG_FORMAT))
        root_logger.addHandler(handler)
1014515
public function setupLogging(LoggerInterface $logger, array $incrementalAttributesToLog = ['dn'])
    {
        if (empty($incrementalAttributesToLog)) {
            throw new InvalidArgumentException('List of entry attributes to be logged during incremental sync cannot be empty');
        }
        $this->logger                     = $logger;
        $this->incrementalAttributesToLog = $incrementalAttributesToLog;
    }
1314074
@Override
	public void configure(final LoggerContext loggerContext) {
		addInfo("Setting up custom configuration.");
		final LoggerContext context = (LoggerContext) StaticLoggerBinder.getSingleton().getLoggerFactory();
		final JoranConfigurator jc = new JoranConfigurator();
		jc.setContext(context);
		context.reset();
		context.putProperty("application-name", appName);
		openStream(jc);
	}
718641
def set_logger(self, logger):
        
        self.__logger = logger
        self.session.set_logger(self.__logger)
465082
public void setBaseEvidence(EvidenceDir targetDir) {

        if (!(targetDir.exists())) {
            LOG.error("evidence.error");
        } else {
            EvidenceDir baseDir = EvidenceDir.getBase(targetDir.getBrowser());
            LOG.info("base.evidence.set", targetDir.getDir());
            copy(targetDir.getDir(), baseDir.getDir());

        }

    }
7283
private static synchronized void initializeLog4JSubSystem(String configFile)
    {
        LoggerFactory.getBootLogger().info("Initializing Log4J using file: '" + configFile + "'");
        if(configFile == null || "".equals(configFile.trim()))
        {
            // no configuration available
            LoggerFactory.getBootLogger().warn("No log4j configuration file specified");
        }
        else
        {
            // try resource look in classpath
            URL url = ClassHelper.getResource(configFile);
            LoggerFactory.getBootLogger().info("Initializing Log4J : resource from config file:" + url);
            if (url != null)
            {
                PropertyConfigurator.configure(url);
            }
            // if file is not in classpath try ordinary filesystem lookup
            else
            {
                PropertyConfigurator.configure(configFile);
            }
        }
        log4jConfigured = true;
    }
1034077
def setLogger( logger )
      if logger
         if logger.is_a?( Logger )
            if @logger and @logger != logger
               @logger.closeLogFile()
            end
            @logger = logger
         end
      else
         @logger.closeLogFile() if @logger
         @logger = nil
      end
   end
719565
def setup_logging(level, logger_name=None, handler=None, log_formatter=None):
    
    root_logger = logging.getLogger()

    if logger_name is None:
        logger = root_logger
        root_logger.info("Set %i level to root logger", level)
    else:
        logger = logging.getLogger(logger_name)
        root_logger.info("Set %i level to logger %r", level, logger_name)

    if level == 100:
        # Remove all existing handlers and set only NullHandler():
        set_handler(logger, logging.NullHandler())
        logger.disabled = True
        return

    logger.setLevel(level=level)

    if log_formatter is None:
        log_formatter = "%(relativeCreated)-5d %(levelname)8s %(module)13s %(lineno)d %(message)s"
    formatter = logging.Formatter(log_formatter)

    if handler is None:
        handler = logging.StreamHandler()
    handler.setFormatter(formatter)

    if hasattr(handler, "baseFilename"):
        root_logger.debug("Log to file: %s (%s)", handler.baseFilename, repr(handler))
    else:
        root_logger.debug("Log to handler: %s", repr(handler))

    # Remove all existing handlers and set only the given handler:
    set_handler(logger, handler)

    log.log(level, "Set logging to level %i %s", level, logging.getLevelName(level))
1019779
public void init(BaseDatabase database, Record record)
    {
        super.init(database, record);

        m_gridList = new DataRecordList();      
        m_iEndOfFileIndex = UNKNOWN_POSITION; // Actual end of file (-1 means don't know)

        m_gridBuffer = new DataRecordBuffer();
        m_gridNew = new DataRecordBuffer();
        m_iPhysicalFilePosition = UNKNOWN_POSITION;
        m_iLogicalFilePosition = UNKNOWN_POSITION;

        if (((record.getOpenMode() & DBConstants.OPEN_READ_ONLY) != DBConstants.OPEN_READ_ONLY)
            && (record.getCounterField() != null))
                record.setOpenMode(record.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);  // Must have for GridTable to re-read.
    }
222297
public static void main(String[] args) throws Exception {
        if (args.length != 1) {
            System.err.println("usage: generator <basedir>");
            System.exit(-1);
        }

        File baseDir = new File(args[0]);
        System.out.println("Using baseDir: " + baseDir.getAbsolutePath());

        new ProjectGenerator(baseDir).generate();
    }
626538
def setup_logging(
        config_directories=None,
        config_file=None,
        default_level=logging.INFO,
        default_filename="logging.yml"
):
    
    config_found = False
    config_file_path = None
    if config_file:
        config_file_path = config_file
        if os.path.isfile(config_file_path) and os.access(config_file_path, os.R_OK):
            config_found = True
    else:
        for directory in config_directories:
            if directory is None:
                continue
            config_file_path = os.path.join(directory, default_filename)
            if os.path.isfile(config_file_path) and os.access(config_file_path, os.R_OK):
                config_found = True
                break
    if config_found:
        with open(config_file_path, 'rt') as ymlfile:
            config = yaml.safe_load(ymlfile.read())
        logging.config.dictConfig(config)
    else:
        logging.basicConfig(level=default_level)
1107627
public static String relativize(Path baseDir, Path file) {
        String path = baseDir.toUri().relativize(file.toUri()).getPath();
        if (!"/".equals(baseDir.getFileSystem().getSeparator())) {
            // For windows
            return path.replace(baseDir.getFileSystem().getSeparator(), "/");
        } else {
            return path;
        }
    }
1196439
@SuppressWarnings("unchecked")
  public static void init(boolean mustLog) {
    if ((hasToLog == null || hasToLog != mustLog) && mustLog) {
      synchronized (LoggerFactory.class) {
        if (hasToLog == null || hasToLog != mustLog) {
          try {
            Class.forName("org.slf4j.LoggerFactory");
            hasToLog = Boolean.TRUE;
          } catch (ClassNotFoundException classNotFound) {
            System.out.println("Logging cannot be activated, missing slf4j dependency");
            hasToLog = Boolean.FALSE;
          }
        }
      }
    }

  }
486058
private function saveToCache($basedir)
    {
        if (true === $this->debug) {
            return false;
        }

        if (null !== $this->cache) {
            return $this->cache->save($this->getCacheId($basedir), serialize($this->raw_parameters), null, null, true);
        }

        return false;
    }
513594
private function getConfigDumpRightDirectory($baseDir)
    {
        $configDumpDir = $this->app->getBaseRepository();
        if ($this->persistPerContext && ApplicationInterface::DEFAULT_CONTEXT !== $this->app->getContext()) {
            $configDumpDir .= DIRECTORY_SEPARATOR.$this->app->getContext();
        }

        $configDumpDir .= DIRECTORY_SEPARATOR.'Config';
        if ($this->persistPerEnvironment && ApplicationInterface::DEFAULT_ENVIRONMENT !== $this->app->getEnvironment()) {
            $configDumpDir .= DIRECTORY_SEPARATOR.$this->app->getEnvironment();
        }

        $key = $this->app->getContainer()->get('bundle.loader')->getBundleIdByBaseDir($baseDir);
        if (null !== $key) {
            $configDumpDir .= DIRECTORY_SEPARATOR.'bundle'.DIRECTORY_SEPARATOR.$key;
        }

        if (!is_dir($configDumpDir) && false === @mkdir($configDumpDir, 0755, true)) {
            throw new \Exception('Unable to create config dump directory');
        }

        return $configDumpDir;
    }