Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven logs in the output file and also in the console

Tags:

maven-2

maven

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

like image 807
user2400564 Avatar asked May 31 '13 08:05

user2400564


1 Answers

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.
like image 125
Torsten Avatar answered Sep 17 '22 11:09

Torsten