Merges the roll pattern name into the file name
@param logFileName The log file name
@param rollPattern The rolling log file appender roll pattern
@return the merged file pattern
347506
protected static String insertPattern(final String logFileName, final String rollPattern) {   
    int index = logFileName.lastIndexOf('.');
    if(index==-1) return logFileName + rollPattern;
    return logFileName.substring(0, index) + rollPattern + logFileName.substring(index); 
  }
689702
public static Pattern createRegexp(String likePattern)
   {
      // - escape all non alphabetic characters
      // - escape constructs like \<alphabetic char> into \\<alphabetic char>
      // - replace non escaped _ % into . and .*
      StringBuilder regexp = new StringBuilder();
      boolean escaped = false;
      for (int i = 0; i < likePattern.length(); i++)
      {
         if (likePattern.charAt(i) == '\\')
         {
            if (escaped)
            {
               regexp.append("\\\\");
               escaped = false;
            }
            else
            {
               escaped = true;
            }
         }
         else
         {
            if (Character.isLetterOrDigit(likePattern.charAt(i)))
            {
               if (escaped)
               {
                  regexp.append("\\\\").append(likePattern.charAt(i));
                  escaped = false;
               }
               else
               {
                  regexp.append(likePattern.charAt(i));
               }
            }
            else
            {
               if (escaped)
               {
                  regexp.append('\\').append(likePattern.charAt(i));
                  escaped = false;
               }
               else
               {
                  switch (likePattern.charAt(i))
                  {
                     case '_' :
                        regexp.append('.');
                        break;
                     case '%' :
                        regexp.append(".*");
                        break;
                     default :
                        regexp.append('\\').append(likePattern.charAt(i));
                  }
               }
            }
         }
      }
      return Pattern.compile(regexp.toString(), Pattern.DOTALL);
   }
415688
protected XmlSchemaPatternFacet createPatternFacet(final String pattern) {
        XmlSchemaPatternFacet xmlSchemaPatternFacet = new XmlSchemaPatternFacet();
        xmlSchemaPatternFacet.setValue(pattern);
        return xmlSchemaPatternFacet;
    }
403354
public void addPattern(Pattern pattern) {
        if (patterns == null) {
            patterns = new ArrayList<Pattern>();
        }

        patterns.add(pattern);
    }
71751
public SftpFile[] matchFilesWithPattern(SftpFile[] files,
			String fileNameRegExp) throws SftpStatusException, SshException {
		// set up variables for regexp matching
		Pattern mpattern = null;
		PatternCompiler aPCompiler = new Perl5Compiler();
		PatternMatcher aPerl5Matcher = new Perl5Matcher();
		// Attempt to compile the pattern. If the pattern is not valid,
		// throw exception
		try {
			mpattern = aPCompiler.compile(fileNameRegExp);
		} catch (MalformedPatternException e) {
			throw new SshException("Invalid regular expression:"
					+ e.getMessage(), SshException.BAD_API_USAGE);
		}

		Vector<SftpFile> matchedNames = new Vector<SftpFile>();

		for (int i = 0; i < files.length; i++) {
			if ((!files[i].getFilename().equals("."))
					&& (!files[i].getFilename().equals(".."))
					&& (!files[i].isDirectory())) {
				if (aPerl5Matcher.matches(files[i].getFilename(), mpattern)) {
					// call get for each match, passing true, so that it doesnt
					// repeat the search
					matchedNames.addElement(files[i]);
				}
			}
		}

		// return (SftpFile[]) matchedNames.toArray(new SftpFile[0]);
		SftpFile[] matchedNamesSftpFiles = new SftpFile[matchedNames.size()];
		matchedNames.copyInto(matchedNamesSftpFiles);
		return matchedNamesSftpFiles;
	}
52912
protected final void parseFileNamePattern() {
    List converters = new ArrayList();
    List fields = new ArrayList();

    ExtrasPatternParser.parse(
            fileNamePatternStr, converters, fields, null,
            ExtrasPatternParser.getFileNamePatternRules());
    patternConverters = new PatternConverter[converters.size()];
    patternConverters =
      (PatternConverter[]) converters.toArray(patternConverters);
    patternFields = new ExtrasFormattingInfo[converters.size()];
    patternFields = (ExtrasFormattingInfo[]) fields.toArray(patternFields);
  }
995272
public static final String convertPattern(String pattern) {
        if (pattern == null) {
            return null;
        }
        else {
            String convertedPattern = pattern;
            for (PatternConverter converter : PATTERN_CONVERTERS) {
                convertedPattern = converter.convert(convertedPattern);
            }

            return convertedPattern;
        }
    }
816269
public String applyTransletNamePattern(String transletName) {
        if (transletName == null) {
            return null;
        }
        return transletRuleRegistry.applyTransletNamePattern(transletName, true);
    }
1348462
function updatePoFiles(filename, pattern) {
  var merged = [];
  var searchPath = path.dirname(filename);

  pattern = pattern || '*.po';

  glob.sync(pattern, {
    cwd: path.dirname(filename)
  }).forEach(function(file) {
    var poFile = path.join(searchPath, file);
    merged.push(mergeFiles(filename, poFile));
  });

  return Promise.all(merged);
}
162546
File syncLog(long stamp, final long startTxId, final URL url, String name, File tmpFile)
      throws IOException {
    final File[] localPaths = new File[] { tmpFile };

    // TODO add security if needed.
    LOG.info("Synchronizing log " + name + " from " + url);
    boolean success = false;
    try {
      TransferFsImage.doGetUrl(
          url,
          ImageSet.convertFilesToStreams(localPaths, journalStorage,
              url.toString()), journalStorage, true);
      assert tmpFile.exists();
      success = true;
    } finally {
      if (!success) {
        if (!tmpFile.delete()) {
          LOG.warn("Failed to delete temporary file " + tmpFile);
        }
      }
    }
    return tmpFile;
  }
891906
protected org.apache.log4j.helpers.PatternParser createPatternParser(final String pattern) {
		return new FoundationLoggingPatternParser(pattern);
	}
984678
private static DateTimeFormatter createFormatterForPattern(String pattern) {
        if (pattern == null || pattern.length() == 0) {
            throw new IllegalArgumentException("Invalid pattern specification");
        }
        DateTimeFormatter formatter = cPatternCache.get(pattern);
        if (formatter == null) {
            DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
            parsePatternTo(builder, pattern);
            formatter = builder.toFormatter();
            if (cPatternCache.size() < PATTERN_CACHE_SIZE) {
                // the size check is not locked against concurrent access,
                // but is accepted to be slightly off in contention scenarios.
                DateTimeFormatter oldFormatter = cPatternCache.putIfAbsent(pattern, formatter);
                if (oldFormatter != null) {
                    formatter = oldFormatter;
                }
            }
        }
        return formatter;
    }
592229
@Override
	public synchronized String format(LogRecord record) {
        // clear string builder content of previous runs
        BUILDER.setLength(0);

        // build log message
        appendDateTime(record);
        appendApplication();
        appendLevel(record);
        appendClass(record);
        appendMessage(record);
        appendThrowable(record);
        appendNewLine();

        return BUILDER.toString();
    }
1026369
private int getLogFileIndex(String fileName) {
		int fileIndex = 0;
		try {
			fileIndex = Integer.parseInt(fileName.substring(fileName
					.lastIndexOf(COUNT_SEPARATOR) + 1));
		} catch (NumberFormatException e) {
			e.printStackTrace();
		}
		return fileIndex;
	}
789550
def _make_scatter_logfile_name(cls, key, linkname, job_config):
        
        logfile = job_config.get('logfile', "%s_%s_%s.log" %
                                 (cls.default_prefix_logfile, linkname, key))
        job_config['logfile'] = logfile
1098653
public static boolean isValidPattern(String pattern) {
    if (pattern == null) {
      return false;
    }
    String canon = pattern.replace('/', '.');
    return ClassName.isQualifiedName(canon)
        || ClassName.isStarQualifiedName(canon);
  }
84727
public static List<File> listFileWithRegexFileName(final File rootDir, final String regexFileNamePattern) {
		return Files.fileTreeTraverser().preOrderTraversal(rootDir)
				.filter(new RegexFileNameFilter(regexFileNamePattern)).toList();
	}