I have created a GUI program that uses a class to perform some tasks.
I would like to add logging in both the JFrame and the class. Logs should be kept in a file and displayed in a JTextArea concurrently.
What is a convient solution for this?
Create a wrapper that
public void log(String msg) { appendToJTextArea(msg); LOG.info(msg); }
I suggest using a simple System.out.println() call and then running your application like this:
java -cp path/to/my/class/or/jar/MyClass.class MyClass -debug > myLog.log
Which will create a text pane for you (-debug parameter), as well as put them in a log file for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With