How does Payara Micro determine its logging format (it differs from that specified by default logging.properties)?

眉间皱痕 提交于 2019-12-25 09:08:57

问题


Here is an example of running Payara Micro 172 from the command line. Note its log format:

LANELSON$ java -jar ~/Downloads/payara-micro-4.1.2.172.jar 
[2017-08-06T10:47:56.814-0700] [] [INFO] [] 
[fish.payara.micro.boot.runtime.PayaraMicroRuntimeBuilder] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1502041676814] [levelValue: 800] Built Payara Micro Runtime

OK, that's fine.

I want to change some log levels. I understand I can add --logProperties someLogging.properties and it will pick up the standard Java logging properties from there. Obviously I'd like to add to whatever Payara Micro does, so first I'm going to run it with the --rootdir argument so that its logging.properties is generated for me (so I can crib from it):

LANELSON$ java -jar ~/Downloads/payara-micro-4.1.2.172.jar --rootdir crap
[2017-08-06T10:50:07.112-0700] [] [INFO] [] 
[fish.payara.micro.boot.runtime.PayaraMicroRuntimeBuilder] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1502041807112] [levelValue: 800] Built Payara Micro Runtime

Now when I look in crap/config, I see logging.properties, which looks, in part, like this:

LANELSON$ cat crap/config/logging.properties 
#Payara Micro Logging Properties File

## Handlers
handlers=java.util.logging.ConsoleHandler

…and so on. That's fine. So now I am going to grab that logging.properties and add some levels to it (but not otherwise change it; specifically, I'm going to use the formatters and handlers in it as is). Then I'm going to remove everything else in that crap directory, and go back to launching Payara Micro without the --rootdir argument, but this time with the --logProperties argument:

LANELSON$ java -jar ~/Downloads/payara-micro-4.1.2.172.jar --logProperties crap/config/logging.properties
Aug 06, 2017 10:54:08 AM fish.payara.micro.boot.runtime.PayaraMicroRuntimeBuilder build
INFO: Built Payara Micro Runtime

Note that the formatting has changed. That tells me that the logging.properties that is generated for you when you use the --rootdir argument is not the same as the effective one used internally by Payara Micro when it starts up.

So: how does Payara Micro determine what its logging settings are when it starts up without any other arguments? How can I use those logging properties? Am I being bitten by issue #1672?


回答1:


Hi you are hitting https://github.com/payara/Payara/issues/1672 and this will resolved in Payara 173 via PR https://github.com/payara/Payara/pull/1835



来源:https://stackoverflow.com/questions/45534984/how-does-payara-micro-determine-its-logging-format-it-differs-from-that-specifi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!