public void start() { int errorCount = 0; final String facilityStr = getFirstOption(); if (facilityStr == null) { addError("was expecting a facility string as an option"); return; } facility = SyslogAppenderBase.facilityStringToint(facilityStr); localHostName = getLocalHostname(); try { // ASL doesn't handle milliseconds. if (os.equals("Mac OS X")) { simpleFormat = new SimpleDateFormat("MMM dd HH:mm:ss", new DateFormatSymbols(Locale.US)); } else { simpleFormat = new SimpleDateFormat("MMM dd HH:mm:ss.SSS", new DateFormatSymbols(Locale.US)); } } catch (IllegalArgumentException e) { addError("Could not instantiate SimpleDateFormat", e); errorCount++; } if (errorCount == 0) { super.start(); } }
@Override public void start() { int errorCount = 0; String facilityStr = getFirstOption(); if (facilityStr == null) { addError("was expecting a facility string as an option"); return; } facility = SyslogAppenderBase.facilityStringToint(facilityStr); localHostName = getLocalHostname(); try { final TimeZone tz = TimeZone.getTimeZone("UTC"); dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); dateFormat.setTimeZone(tz); } catch (IllegalArgumentException e) { addError("Could not instantiate SimpleDateFormat", e); errorCount++; } if (errorCount == 0) { super.start(); } }