OpenLiberty / guides-common

Common Guide files
Other
9 stars 6 forks source link

Liberty log is not in JSON format #520

Open fmhwong opened 3 years ago

fmhwong commented 3 years ago

It is recommended to use JSON format for Liberty log when running in containers so that the log entries can be aggregated and analyzed by EFK.

gkwan-ibm commented 3 years ago

@fmhwong, I think you are not only recommend to the openshift guide but also to all the cloud guides, right? How about the guides are using docker or kubernetes?

cc @yeekangc

fmhwong commented 3 years ago

I would recommend to use JSON logging in all cloud guides as all cloud service should have some sort of log aggregation feature such as LogDNA, EFK, etc. For guides that run on local docker, you can leave it as plain text logging as it may be easier to read.

gkwan-ibm commented 3 years ago

Thank you @fmhwong Would you post what should be configured? I assume just update the server.xml, right?

gkwan-ibm commented 3 years ago

Need to consider the following guides

gkwan-ibm commented 3 years ago

Based on https://openliberty.io/docs/latest/log-trace-configuration.html#_json_logging, add following to the server.xml <logging messageFormat="json" messageSource="message,trace,accessLog,ffdc,audit" />

fmhwong commented 3 years ago

I think the best practice is to set the environment variables for containers so that you don't need to rebuild the image if you want to change it in the future.

gkwan-ibm commented 3 years ago

@fmhwong It means better to do it through yaml

yeekangc commented 3 years ago

We can further break this down into one issue for each cloud guide that needs to be updated.