i am using slf4j to save log.Here is the file log config log4j.properties log4j.rootLogger=ALL,CONSOLE,R
#Direct log messages to stdout
#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
#log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L- %m%n
#Direct log messages to file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=./log/KNetBigDataAnalytics.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L- %m%n
I have a main form of swing application here is the code
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public FirstGui() {
// textField.setText(dateFormat.format(date));
getContentPane().setFont(new Font("Tahoma", Font.BOLD, 13));
setResizable(false);
setTitle("KNet Big Data Analytics Server");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 691, 460);
getContentPane().setLayout(null);
JTextArea textArea = new JTextArea();
textArea.setBounds(151, 57, 513, 252);
getContentPane().add(textArea);
JButton btnStartServer = new JButton("Start");
btnStartServer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// MainClass.main();
}
});
btnStartServer.setFont(new Font("Tahoma", Font.BOLD, 12));
btnStartServer.setBounds(182, 363, 89, 23);
getContentPane().add(btnStartServer);
JButton btnStopServer = new JButton("Shutdown");
btnStopServer.setFont(new Font("Tahoma", Font.BOLD, 12));
btnStopServer.setBounds(313, 363, 101, 23);
getContentPane().add(btnStopServer);
JLabel lblNewLabel = new JLabel("Log Viewer");
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel.setBackground(Color.RED);
lblNewLabel.setBounds(151, 17, 83, 29);
getContentPane().add(lblNewLabel);
JSeparator separator = new JSeparator();
separator.setBounds(140, 176, 1, 2);
getContentPane().add(separator);
textField = new JTextField();
textField.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 11));
textField.setBounds(281, 320, 141, 20);
getContentPane().add(textField);
textField.setColumns(10);
new Timer(interval, new ActionListener() {
public void actionPerformed(ActionEvent e) {
Calendar now = Calendar.getInstance();
textField.setText(dateFormat.format(now.getTime()));
}
}).start();
what i want is how do i modify the properties log , in order to have log also in the JtextAreat in the main inteterface Please any help would be appreciated .