Changeset 8:fbbad3cde4f2 in rrlib_logging-java


Ignore:
Timestamp:
14.07.2019 14:11:39 (4 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Adds milliseconds to (optional) timestamp output in log messages - and improves timestamp formatting in general

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LogDomain.java

    r4 r8  
    2626import java.io.FileOutputStream; 
    2727import java.io.PrintStream; 
    28 import java.text.DateFormat; 
     28import java.text.SimpleDateFormat; 
    2929import java.util.ArrayList; 
    3030import java.util.HashSet; 
     
    6868    private ArrayList<PrintStream> outputStreams = new ArrayList<PrintStream>(); 
    6969 
    70     public static final DateFormat format = DateFormat.getTimeInstance(); 
     70    public static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); 
    7171 
    7272    private StringBuilder buffer = new StringBuilder(); // temporary buffer for output string (only use with lock on domain) 
     
    194194     */ 
    195195    private String getTimeString() { 
    196         return format.format(System.currentTimeMillis()); 
     196        return "[" + format.format(System.currentTimeMillis()) + "]"; 
    197197    } 
    198198 
Note: See TracChangeset for help on using the changeset viewer.