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!
ericmj
March 10, 2017, 11:43am
2
You can pipe the output into a file in your shell: mix test > test_output.txt.
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?
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:
tee is a shell command that copies data from standard input to one or more files in addition to standard output, duplicating the input to each output. The name derives from the tee pipe fitting even though the tee command duplicates the input into each output instead of dividing the input into portions for each output. The command is often used with pipes and filters. Similar behaving commands are provided by many shells although syntax varies.
The command is provided in Unix and Unix-like syste...
Usage: mix test | tee test_output.txt (add -a flag if you want to append instead of overwrite)
Maybe use logger_file_backend . I guess - test results - are displayed as info.
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?