Payara Micro日志记录

huangapple go评论57阅读模式
英文:

Payara Micro logging

问题

我使用Payara运行我的Web应用程序,命令是java -jar webapp.war

我要如何设置这个Payara实例的日志输出位置?例如,我想将其设置为/var/log/mywebapp.log,或者相对于Uber Jar文件的位置,应该传递什么命令?

我的目标是通过SSH实时查看日志,所以日志文件需要有一个路径。

英文:

I run my web application with Payara with java -jar webapp.war

How do I set where the this Payara instance would log, for example I want to set it to /var/log/mywebapp.log or just relative to the Uber Jar file, what would be the command to pass?

My goal is to tail the logs from ssh so the log needs to have a path.

答案1

得分: 1

你可以使用命令行来完成,如:java -jar payara-micro.jar --logToFile /path/file.log,或者你可以以编程方式使用 PayaraMicro.getInstance().setUserLogFile("/path/file.log").bootStrap();,但我不清楚是否需要在主方法中使用嵌入式 Payara 来完成此操作。你甚至可以创建一个 logging.properties 文件并进行配置,这样在运行你的 jar 文件时使用 --logProperties logging.properties 参数。

英文:

You can do it using from command line java -jar payara-micro.jar --logToFile /path/file.log or you can do it programmatically using PayaraMicro.getInstance().setUserLogFile("/path/file.log").bootStrap();, but I don't know if you need to use embbeded payara for do this on the main method. You can even create a logging.properties file and configure it, so you use --logProperties logging.properties argument when run your jar file.

huangapple
  • 本文由 发表于 2020年9月10日 05:00:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/63819486.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定