Dexter
March 10, 2017, 11:31am
1
Hi,
I’m start running integration tests with mix run path/test.exs
The result is something like:
IntegrationTests
test 1 (1.2ms)
test 2 (11022.7ms)
test 2 (5000.9ms)
Finished in 16.0 seconds (0.04s on load, 16.0s on tests)
3 tests, 0 failures
How can I log this output to a file?
I know how to log the output of the logger to a different backend.
Is there anything similar with the console output?
Thank you!
1 Like
ericmj
March 10, 2017, 11:43am
2
You can pipe the output into a file in your shell: mix test > test_output.txt
.
3 Likes
Dexter
March 10, 2017, 2:58pm
3
That’s what we are doing right now with a perl-script.
The disadvantage is that we are loosing stdout during mix run is running.
Is there no direct possibility to change the output path in elixir?
1 Like
If all you want is to have the same output go to both stdout and a file then the tee command is exactly what you want:
In computing, tee is a command in command-line interpreters (shells) using standard streams which reads standard input and writes it to both standard output and one or more files, effectively duplicating its input. It is primarily used in conjunction with pipes and filters. The command is named after the T-splitter used in plumbing.
The tee command is normally used to split the output of a program so that it can be both displayed and saved in a file. The command can be used to capture intermed...
Usage: mix test | tee test_output.txt (add -a flag if you want to append instead of overwrite)
5 Likes
Maybe use logger_file_backend . I guess - test results - are displayed as info
.
1 Like
catra
July 1, 2020, 12:50am
7
derpydev:
tee (command)
I used the tee
command but all the warnings are not included. Is there a way to include them into the output file?