I need to see the Maven logs in the file and also in the console.
If I try using mvn clean install > log.txt
. Logs are storing in the file only, console output is not displaying.
Can anyone please suggest how to display the logs in the console and also to store in the file in the Maven Build?
Thanks in advance.
Regards, Karthik
Taken you are running on a UNIX/Linux environment the following should solve your problem:
mvn clean install | tee log.txt
Windows users can use a Cygwin shell to use this command as well. There is also Wintee available for this purpose.
You can find usage instructions on the tee manpage:
NAME
tee - read from standard input and write to standard output and files
SYNOPSIS
tee [OPTION]... [FILE]...
DESCRIPTION
Copy standard input to each FILE, and also to standard output.
-a, --append
append to the given FILEs, do not overwrite
-i, --ignore-interrupts
ignore interrupt signals
--help display this help and exit
--version
output version information and exit
If a FILE is -, copy again to standard output.
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