MDev
MDev

Reputation: 147

What logging apis does Liberty provide?

Obviously Java.util.logging is an option but are any other options available (possibly by enabling a feature)? I did see the eventLogging-1.0 feature but I can't find the related jar or docs.

Specifically, I want to provide a unique identifire with some of my logs, similar to how Liberty does it. Example, see CWWK* below

[3/30/17 13:29:27:198 PDT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           A CWWKE0001I: The server defaultServer has been launched.
[3/30/17 13:29:28:638 PDT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           I CWWKE0002I: The kernel started after 1.695 seconds

I could just wrap my calls to Logger.log() and append the ids myself but I figured there has to be a better way. I shouldn't have to include a new lib (ex log4j) since the internal Liberty logs are already doing this.

Upvotes: 0

Views: 322

Answers (1)

Alasdair
Alasdair

Reputation: 3176

The CWWK* prefix is part of the message in the NLS message files. There is no magic that prepends these ids to the log messages. They only appear for NLS enabled messages, if you look in trace.

The eventLogging feature essentially causes important events to be logged to the messages.log, it isn't providing an application logging API which is why you can't find any documentation on it.

Liberty doesn't provide a logging API, if java.util.logging doesn't work for you then you can use log4j or slf4j by putting those logging libraries in your application.

Upvotes: 2

Related Questions