Exemplo n.º 1
0
 static {
   try {
     TIME_STAMP_DELIMITER = ": ".getBytes(CharsetSupport.getCharset());
   } catch (UnsupportedEncodingException e) {
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 2
0
 private void writeMessage(FileOutputStream stream, String message, boolean forceTimestamp) {
   try {
     if (forceTimestamp || includeTimestampForMessages) {
       writeTimeStamp(stream);
     }
     stream.write(message.getBytes(CharsetSupport.getCharset()));
     stream.write('\n');
     stream.flush();
     if (syncAfterWrite) {
       stream.getFD().sync();
     }
   } catch (IOException e) {
     // QFJ-459: no point trying to log the error in the file if we had an IOException
     // we will end up with a java.lang.StackOverflowError
     System.err.println("error writing message to log : " + message);
     e.printStackTrace(System.err);
   }
 }
Exemplo n.º 3
0
 private void writeTimeStamp(OutputStream out) throws IOException {
   String formattedTime = UtcTimestampConverter.convert(SystemTime.getDate(), includeMillis);
   out.write(formattedTime.getBytes(CharsetSupport.getCharset()));
   out.write(TIME_STAMP_DELIMITER);
 }