if (!initialised) {
init(INFO);
}
Writer stream = getStreamByName(streamName);
if (stream != null) {
Writer fullMessage = new StringWriter();
String date = null;
synchronized (sdfLog) {
date = sdfLog.format(new Date());
}
try {
fullMessage.write("[");
fullMessage.write(streamName);
fullMessage.write(" ");
fullMessage.write(date);
fullMessage.write("] - ");
if (showThrowingThread) {
fullMessage.write("[");
fullMessage.write(Thread.currentThread().getName());
fullMessage.write("] - ");
}
fullMessage.write(message);
if (error != null) {
fullMessage.write(LINE_SEPARATOR);
PrintWriter pw = new PrintWriter(fullMessage);
error.printStackTrace(pw);
pw.flush();
}
fullMessage.write(LINE_SEPARATOR);
stream.write(fullMessage.toString());
stream.flush();
} catch (IOException err) {
System.err.println(Launcher.RESOURCES.getString("Logger.StreamWriteError", message));
err.printStackTrace(System.err);
}