here is a custom one I made ages ago. Feel free to edit it.
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
public class UltimateLogger {
public UltimateLogger() {
createLogger();
}
public void close() {
loggerFrame.setVisible(false);
loggerFrame.dispose();
}
public void open() {
loggerFrame.setVisible(true);
}
private void createLogger() {
JTabbedPane loggerTab = getTabbedPane();
loggerFrame = getFrame();
loggerFrame.add(loggerTab);
open();
}
private JFrame getFrame() {
JFrame frame = new JFrame("Ultimate Logger");
final Dimension frameDimention = new Dimension(650, 350);
frame.setSize(frameDimention);
frame.setMinimumSize(frameDimention);
return frame;
}
private JTabbedPane getTabbedPane() {
JPanel scrollPanel = new JPanel();
scrollPane = new JScrollPane(scrollPanel);
list = new JList<String>(listModel);
scrollPanel.add(list);
scrollPanel.setLayout(new GridLayout(1, 0));
JTabbedPane tab = new JTabbedPane();
tab.addTab("Ultimate Bot Debug", scrollPane);
return tab;
}
public void log(String loggedString) {
listModel.addElement(getOkHeader() + loggedString);
list.setCellRenderer(new CellRender());
setMaximumScroll();
}
public void logError(String loggedString) {
listModel.addElement(getErrorHeader() + loggedString + "\n");
list.setCellRenderer(new CellRender());
setMaximumScroll();
}
public void logWarning(String loggedString) {
listModel.addElement(getWarningHeader() + loggedString + "\n");
list.setCellRenderer(new CellRender());
setMaximumScroll();
}
private void setMaximumScroll() {
JScrollBar vertical = scrollPane.getVerticalScrollBar();
vertical.setValue(vertical.getMaximum());
}
private String getOkHeader() {
return "[OKAY][UltimateLogger][" + getTimeStamp() + "]: ";
}
private String getErrorHeader() {
return "[ERROR][UltimateLogger][" + getTimeStamp() + "]: ";
}
private String getWarningHeader() {
return "[WARN][UltimateLogger][" + getTimeStamp() + "]: ";
}
public boolean isVisible() {
return loggerFrame.isVisible();
}
public static String getTimeStamp() {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
return SDF.format(timestamp);
}
private final static SimpleDateFormat SDF = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
private JFrame loggerFrame;
private JScrollPane scrollPane;
private final DefaultListModel<String> listModel = new DefaultListModel<String>();
private JList<String> list;
private static class CellRender extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value.toString().contains("ERROR")) {
setForeground(Color.RED);
} else if (value.toString().contains("WARN")) {
setForeground(Color.ORANGE);
} else {
setForeground(Color.GREEN);
}
return this;
}
}
}
public enum LoggerSeverity {
OKAY, WARN, ERROR;
}