I am running some JUnit tests in Eclipse, and my code is generating an XML log file using the java logging APIs. (java.util.logging). Is there an easy way to view this XML log output in Eclipse, other than reading the raw XML? Specifically I want to be able to easily see what threads different log messages have come from.
When using eclipse the main place to look for logging is in the workspace log file located at <workspace>/. metadata/. log .
Go-to Eclipse Menu: Run -> Run Configuration. Go-to Common tab. Under Standard Input and Output: Select Output file checkbox, enter log file name and path where you want logs to be redirected. Apply changes and run your application.
Locating Log Files. Most log files are located in the /var/log/ directory. Some applications such as httpd and samba have a directory within /var/log/ for their log files. You may notice multiple files in the log file directory with numbers after them.
I've been using the SLF4J logging API coupled with the Logback logging implementation. SLF4J can be configured to map log messages in the java.util.logging, log4j, jakarta commons logging, and SLF4j APIs into a common intermediate form. On the other side, the messages can be generated via java.util.logging, log4j, or Logback. It's a flexible approach that works well, especially when you have components that use different logging APIs.
One nice thing about Logback is that you can configure it to send a copy of the log messages to a an Eclipse plug-in. The plug-in and lets you view and filter the log file in a variety of ways. Messages contain the thread that generated them, so it sounds like something you should check out.
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