public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; } if (datePattern.equals(CoreConstants.ISO8601_STR)) { datePattern = CoreConstants.ISO8601_PATTERN; } try { cachingDateFormatter = new CachingDateFormatter(datePattern); // maximumCacheValidity = // CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); // default to the ISO8601 format cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN); } List<String> optionList = getOptionList(); // if the option list contains a TZ option, then set it. if (optionList != null && optionList.size() > 1) { TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1)); cachingDateFormatter.setTimeZone(tz); } }
public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; Locale locale = Locale.ENGLISH; List<String> optionList = getOptionList(); if (optionList != null) { locale = parseLocale(optionList.get(2)); cachingDateFormatter = new CachingDateFormatter(datePattern, locale); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e);
/** * Gets a DateConverter, configured with options and using the default context * @param options the conversion pattern's options * @return the newly created DateConverter */ private DateConverter getDateConverter(String... options) { DateConverter converter = new DateConverter(); converter.setContext(_context); converter.setOptionList(Arrays.asList(options)); return converter; }
/** * Gets the output of a DateConverter, configured with the given settings * @param timestamp _timestamp to display * @param options the conversion pattern's options * @return the DateConverter's output */ private String convert(long timestamp, String... options) { DateConverter converter = getDateConverter(options); converter.start(); return converter.convert(makeLoggingEvent(timestamp)); } }
public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; } if (datePattern.equals(CoreConstants.ISO8601_STR)) { datePattern = CoreConstants.ISO8601_PATTERN; } try { cachingDateFormatter = new CachingDateFormatter(datePattern); // maximumCacheValidity = // CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); // default to the ISO8601 format cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN); } List optionList = getOptionList(); // if the option list contains a TZ option, then set it. if (optionList != null && optionList.size() > 1) { TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1)); cachingDateFormatter.setTimeZone(tz); } }
public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; } if (datePattern.equals(CoreConstants.ISO8601_STR)) { datePattern = CoreConstants.ISO8601_PATTERN; } try { simpleFormat = new SimpleDateFormat(datePattern); // maximumCacheValidity = // CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); // default to the ISO8601 format simpleFormat = new SimpleDateFormat(CoreConstants.ISO8601_PATTERN); } List optionList = getOptionList(); // if the option list contains a TZ option, then set it. if (optionList != null && optionList.size() > 1) { TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1)); simpleFormat.setTimeZone(tz); } }
public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; } if (datePattern.equals(CoreConstants.ISO8601_STR)) { datePattern = CoreConstants.ISO8601_PATTERN; } try { cachingDateFormatter = new CachingDateFormatter(datePattern); // maximumCacheValidity = // CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); // default to the ISO8601 format cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN); } List optionList = getOptionList(); // if the option list contains a TZ option, then set it. if (optionList != null && optionList.size() > 1) { TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1)); cachingDateFormatter.setTimeZone(tz); } }
public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; } if (datePattern.equals(CoreConstants.ISO8601_STR)) { datePattern = CoreConstants.ISO8601_PATTERN; } try { cachingDateFormatter = new CachingDateFormatter(datePattern); // maximumCacheValidity = // CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); // default to the ISO8601 format cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN); } List<String> optionList = getOptionList(); // if the option list contains a TZ option, then set it. if (optionList != null && optionList.size() > 1) { TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1)); cachingDateFormatter.setTimeZone(tz); } }
public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; } if (datePattern.equals(CoreConstants.ISO8601_STR)) { datePattern = CoreConstants.ISO8601_PATTERN; } try { cachingDateFormatter = new CachingDateFormatter(datePattern); // maximumCacheValidity = // CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); // default to the ISO8601 format cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN); } List<String> optionList = getOptionList(); // if the option list contains a TZ option, then set it. if (optionList != null && optionList.size() > 1) { TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1)); cachingDateFormatter.setTimeZone(tz); } }
public void start() { String datePattern = getFirstOption(); if (datePattern == null) { datePattern = CoreConstants.ISO8601_PATTERN; } if (datePattern.equals(CoreConstants.ISO8601_STR)) { datePattern = CoreConstants.ISO8601_PATTERN; } try { cachingDateFormatter = new CachingDateFormatter(datePattern); // maximumCacheValidity = // CachedDateFormat.getMaximumCacheValidity(pattern); } catch (IllegalArgumentException e) { addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e); // default to the ISO8601 format cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN); } List optionList = getOptionList(); // if the option list contains a TZ option, then set it. if (optionList != null && optionList.size() > 1) { TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1)); cachingDateFormatter.setTimeZone(tz); } }