|
|
@@ -0,0 +1,56 @@ |
|
|
|
/* |
|
|
|
* To change this license header, choose License Headers in Project Properties. |
|
|
|
* To change this template file, choose Tools | Templates |
|
|
|
* and open the template in the editor. |
|
|
|
*/ |
|
|
|
|
|
|
|
package chatprogramm.logger; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.GregorianCalendar; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.TimeZone; |
|
|
|
import java.util.logging.LogRecord; |
|
|
|
import java.util.logging.SimpleFormatter; |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @author nobody |
|
|
|
*/ |
|
|
|
public class OhmLoggerFormatter extends SimpleFormatter |
|
|
|
{ |
|
|
|
public OhmLoggerFormatter() |
|
|
|
{ |
|
|
|
super(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String format(LogRecord record) |
|
|
|
{ |
|
|
|
String myLog; |
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS", Locale.GERMANY); |
|
|
|
GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("Europe/Berlin")); |
|
|
|
calendar.setTimeInMillis(record.getMillis()); |
|
|
|
myLog = sdf.format(calendar.getTime()); |
|
|
|
myLog = addSemikolon(myLog); |
|
|
|
|
|
|
|
myLog += record.getLevel().toString(); |
|
|
|
myLog = addSemikolon(myLog); |
|
|
|
|
|
|
|
myLog += record.getSourceClassName(); |
|
|
|
myLog = addSemikolon(myLog); |
|
|
|
|
|
|
|
myLog += record.getMessage(); |
|
|
|
myLog = addSemikolon(myLog); |
|
|
|
|
|
|
|
myLog += "\n"; |
|
|
|
|
|
|
|
return myLog; |
|
|
|
} |
|
|
|
|
|
|
|
private String addSemikolon(String myString) |
|
|
|
{ |
|
|
|
return myString += ("; "); |
|
|
|
} |
|
|
|
} |