Returns logging directory, creating one if necessary. See "Logdir" section  of design doc on naming convention.
320270
def logdir(self):
    """"""

    run_name = ncluster_globals.get_run_for_task(self)
    logdir = ncluster_globals.get_logdir(run_name)
    if logdir:
      return logdir

    # create logdir. Only single task in a group creates the logdir
    if ncluster_globals.is_chief(self, run_name):
      chief = self
    else:
      chief = ncluster_globals.get_chief(run_name)

    chief.setup_logdir()
    return ncluster_globals.get_logdir(run_name)
143926
def create_bag(dir_bag):
    
    logger_bagit.info("enter create_bag")
    # if not dir_bag:
    #     dir_bag = os.getcwd()
    try:
        bag = bagit.make_bag(dir_bag, {'Name': 'LiPD Project', 'Reference': 'www.lipds.net', 'DOI-Resolved': 'True'})
        logger_bagit.info("created bag")
        return bag
    except FileNotFoundError as e:
        print("Error: directory not found to create bagit")
        logger_bagit.debug("create_bag: FileNotFoundError: failed to create bagit, {}".format(e))
    except Exception as e:
        print("Error: failed to create bagit bag")
        logger_bagit.debug("create_bag: Exception: failed to create bag, {}".format(e))
    return None
751732
private DirectoryService createDirectoryService() {

        final DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
        try {
            factory.init("scribble");
            return factory.getDirectoryService();
        } catch (Exception e) { //NOSONAR

            throw new AssertionError("Unable to create directory service", e);
        }
    }
1197287
def get_log_dir(self, conf_file):
        
        log_dir = None

        with open(conf_file, 'r') as conf_f:
            for line in conf_f:
                line = line.split('#')[0].strip()

                try:
                    (key, value) = line.split('=', 1)
                    if key.strip() == 'log-dir':
                        log_dir = value.strip()
                except ValueError:
                    pass

        return log_dir
1189540
def get_logging_dir(appname='default'):
    
    from utool._internal import meta_util_cache
    from utool._internal import meta_util_cplat
    from utool import util_cache
    if appname is None or  appname == 'default':
        appname = util_cache.get_default_appname()
    resource_dpath = meta_util_cplat.get_resource_dir()
    default = join(resource_dpath, appname, 'logs')
    # Check global cache for a custom logging dir otherwise
    # use the default.
    log_dir = meta_util_cache.global_cache_read(logdir_cacheid,
                                                appname=appname,
                                                default=default)
    log_dir_realpath = realpath(log_dir)
    return log_dir_realpath
1174356
def init_logger(root_dir, name="train.log"):
    
    os.makedirs(root_dir, exist_ok=True)
    log_formatter = logging.Formatter("%(message)s")
    logger = logging.getLogger(name)
    file_handler = logging.FileHandler("{0}/{1}".format(root_dir, name), mode='w')
    file_handler.setFormatter(log_formatter)
    logger.addHandler(file_handler)
    console_handler = logging.StreamHandler()
    console_handler.setFormatter(log_formatter)
    logger.addHandler(console_handler)
    logger.setLevel(logging.INFO)
    return logger
562587
def setup_logdir(self):
    # todo: locking on logdir creation

    
    run_name = ncluster_globals.get_run_for_task(self)
    self.log("Creating logdir for run "+run_name)
    logdir_root = ncluster_globals.LOGDIR_ROOT
    assert logdir_root

    self.run(f'mkdir -p {logdir_root}')
    find_command = f'find {logdir_root} -maxdepth 1 -type d'

    stdout, stderr = self.run_with_output(find_command)
    logdir = f"{logdir_root}/{run_name}"

    counter = 0
    while logdir in stdout:
      counter += 1
      new_logdir = f'{logdir_root}/{run_name}.{counter:02d}'
      self.log(f'Warning, logdir {logdir} exists, deduping to {new_logdir}')
      logdir = new_logdir
    self.run(f'mkdir -p {logdir}')

    ncluster_globals.set_logdir(run_name, logdir)
    return logdir
2968
def getLoggingLocation(self):
		""""""
		if sys.platform == "win32":
			modulePath = os.path.realpath(__file__)
			modulePath = modulePath[:modulePath.rfind("/")]
			return modulePath
		else:
			return "/tmp"
		return ""
488510
def _get_config_dir():
    
    if 'SAWTOOTH_HOME' in os.environ:
        return os.path.join(os.environ['SAWTOOTH_HOME'], 'etc')

    if os.name == 'nt':
        base_dir = \
            os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
        return os.path.join(base_dir, 'conf')

    return '/etc/sawtooth'
1237638
def make_directory(directory):
    
    if not os.path.isdir(directory):
        os.mkdir(directory)
        logger.info('Path {} not found, I will create it.'
                    .format(directory))
1334827
protected function getLogPath($log)
    {

        $dir = $this->log_root.'/'.$log.'/';

        if(!is_dir($dir)){
            mkdir($dir, 0777, true);
        }

        return $dir;
    }
207139
def setup_prefix_logging(logdir):
    
    if not os.path.exists(logdir):
        os.mkdir(logdir)

    file_handler = logging.FileHandler(
        filename=os.path.join(logdir, 'lago.log'),
    )
    file_formatter = get_default_log_formatter()
    file_handler.setFormatter(file_formatter)
    logging.root.addHandler(file_handler)
    hide_paramiko_logs()
    hide_stevedore_logs()
67687
function getLogDirectoryElements(settings) {
        var elements,
            platform = process.platform;

        if (settings.logRoot) {
            elements = [settings.logRoot, settings.module];
        } else if (platform === "darwin") {
            elements = [process.env.HOME, "Library", "Logs", settings.vendor, settings.application, settings.module];
        } else if (platform === "win32") {
            elements = [process.env.APPDATA, settings.vendor, settings.application, settings.module, "logs"];
        } else {
            elements = [process.env.HOME, settings.vendor, settings.application, settings.module, "logs"];
        }
        
        return elements;
    }
125856
private static function _crateLogsFolder()
    {
        // If folder doesn't exist attempt to create it
        if (!file_exists(self::LOGS_FOLDER_PATH)) {
            mkdir(self::LOGS_FOLDER_PATH, 0755, true);
            $htaccessHandler = fopen(self::LOGS_FOLDER_PATH . '.htaccess', 'w');
            fwrite($htaccessHandler, 'deny from all');
            fclose($htaccessHandler);
        }
    }
1130151
@Override
    public File getServerLogDirectory() {
        String logLocation = TrConfigurator.getLogLocation();
        if (logLocation != null) {
            return new File(logLocation);
        } else {
            return null;
        }
    }
148816
protected static function initLogDirectory () {
		//if (static::$logDirectoryInitialized) return;
		$sysCfgDebug = static::getSystemCfgDebugSection();
		$logDirConfiguredPath = isset($sysCfgDebug['logDirectory']) 
			? $sysCfgDebug['logDirectory'] 
			: static::$LogDirectory;
		if (mb_substr($logDirConfiguredPath, 0, 1) === '~') {
			$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
			$logDirAbsPath = $app->GetRequest()->GetAppRoot() . '/' . ltrim(mb_substr($logDirConfiguredPath, 1), '/');
		} else {
			$logDirAbsPath = $logDirConfiguredPath;
		}
		static::$LogDirectory = $logDirAbsPath;
		try {
			if (!is_dir($logDirAbsPath)) {
				$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
				if (!mkdir($logDirAbsPath, 0777, TRUE))
					throw new \RuntimeException(
						'['.$selfClass."] It was not possible to create log directory: `".$logDirAbsPath."`."
					);
				if (!is_writable($logDirAbsPath))
					if (!chmod($logDirAbsPath, 0777))
						throw new \RuntimeException(
							'['.$selfClass."] It was not possible to setup privileges to log directory: `".$logDirAbsPath."` to writeable mode 0777."
						);
			}
		} catch (\Exception $e) {
			$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
			die('['.$selfClass.'] ' . $e->getMessage());
		}
		static::$logDirectoryInitialized = TRUE;
		return $logDirAbsPath;
	}
1319352
def Dir(self, name, create=True):
        """"""
        return self.dir.Dir(name, create=create)