My application has a rather non-trivial, yet standard, log configuration.
It includes a console appender and a rolling size-based file appender.
When I’m running the tests, thru the IDE or with maven, where is the least surprising place to save the log files?
5
If I’m checking out a logs on a server at my company I always go straight to the logs folder. In my work place the logs folder is the most intuitive location for logs.
My suggestion is follow how your workplace does it, and if you are starting a new project then create a logs folder.
Automated test when run should not really make a dent on the environment they run in. It is very annoying when you run the test suite on someone else’s code and find a bunch of files have been created in random places. This can lead to accidentally adding the files into version control and non-repeatable tests.
With the example of logging I would dump everything out to the console because :
- You can redirect the logs to a file when running Maven test when required, so
mvn test > my_log
- When running the tests through an IDE you can easily scroll through the output without worrying that your missing something.
If your logging a large amount of data then grep and sed are your friends.