我需要在文件和控制台中查看 Maven 日志。
如果我尝试使用 mvn clean install > log.txt
.日志仅存储在文件中,不显示控制台输出。
任何人都可以建议如何在控制台中显示日志以及如何存储在 Maven Build 的文件中?
提前致谢。
问候,
卡尔蒂克
最佳答案
假设您在 UNIX/Linux 环境中运行,以下内容应该可以解决您的问题:
mvn clean install | tee log.txt
Windows 用户可以使用 Cygwin shell 也可以使用此命令。还有Wintee可用于此目的。
您可以在 tee 联机帮助页上找到使用说明:
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.
关于Maven 登录输出文件和控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16853530/