2

The documentation at https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/rwlp_logging.html lists the following config snippet for configuring logs to go to the console in JSON format (a useful configuration when Liberty is running inside a Linux container like in a kubernetes pod):

com.ibm.ws.logging.console.format=json
com.ibm.ws.logging.console.log.level=info
com.ibm.ws.logging.console.source=message,trace,accessLog,ffdc,audit

However, I noticed that when I increase the log level inside my server.xml (say to FINER to enable tracing), the trace messages are also emitted to the console. I assume its because the source is configured to pick up messages from the trace, but what I don't understand is whether/how that interacts with the consoleLogLevel setting.

Why specify a com.ibm.ws.logging.console.log.level if its just going to include everything from message and trace log files anyway?

lmsurprenant
  • 1,723
  • 2
  • 14
  • 28

1 Answers1

3

The com.ibm.ws.logging.console.source bootstrap property controls which sources the console handler will subscribe to. This means, if there is any trace (typically levels FINE / FINER / FINEST) enabled by the traceSpecification, that content will be consumed by the console handler and output as JSON to console.

So, setting...

com.ibm.ws.logging.console.source=message,trace,accessLog,ffdc,audit

means that the console handler will receive any log, trace, access log, ffdc, and audit events that are generated by the system.

If com.ibm.ws.logging.console.log.level is specified, it controls which log events are filtered out by the console handler. By setting com.ibm.ws.logging.console.log.level=WARNING you won't see INFO level messages in the console output unless you also explicitly set consoleLogLevel=info in the server.xml.

Note that logging settings explicitly set in the <logging> element in the server.xml (which is processed when the config manager is ready) override any configuration set using environment variables or the bootstrap.properties file (which are processed very early in the server startup process). In practice this means you should use bootstrap.properties or environment variables for logging configuration, and just use the logging element in the server.xml file to specify things you want to override while the server is running.

dbourne
  • 266
  • 1
  • 5
  • I must be missing something... I have `com.ibm.ws.logging.console.log.level=warning` but my console output seems to include all info messages (as well as whatever trace messages I enable in my server.xml). Does the `` config in server.xml overwrite the value of `com.ibm.ws.logging.console.log.level`? – lmsurprenant Mar 05 '19 at 22:59
  • @Imsurprenant, that's a good question -- I've updated my answer above to cover that. – dbourne Mar 11 '19 at 11:47
  • I find myself back here now and then because I still don't quite understand all the intricacies. Like what happens when traceFileName is set to `stdout`? In my latest deployment, I have WLP_LOGGING_CONSOLE_LOGLEVEL set to AUDIT, but I'm still seeing messages at level info (and fine) in the console. Does `com.ibm.ws.logging.console.log.level` not apply when tracing is set to go to the console? – lmsurprenant Apr 02 '21 at 21:33