Anuroop
Anuroop

Reputation: 1002

How to log messages to multiple log files in Liberty Profile Server?

I want to log messages from different applications of Liberty Profile Server to different log files. For example, suppose there are two application like App_1 and App_2, then what I want is log message from App_1 should go to app1_message.log and messages from App_2 should go to app2_messages.log.

I have tried to achieve this by specifying multiple tags in server.xml as below but it did not work:-

<logging consoleLogLevel="INFO" traceFormat="ADVANCED" traceSpecification="*=all" />

<logging traceSpecification="*=audit:com.myco.mypackage.*=debug" messageFileName="app1_messages.log"/>

Another way to achieve this is through code by creating FileHandler object as suggested by this link:Multiple apps in glassfish JUL logging to different log files?

But we want to do this purely through configuration file, i.e. through logging.properties file. That is the challenge.

I love Log4J but sadly that is not an option. We are stuck with java.util.logging. Any suggestions/pointers will be helpful.

Upvotes: 0

Views: 1636

Answers (1)

cjackson
cjackson

Reputation: 1637

One option you have if you don't mind a bit more overhead is to create two Liberty server instances; deploy each application to their own server to keep the logging seperate. Beyond that I didn't see any way to configure logging per application (via liberty configuration files), from the IBM knowledge center for Liberty v8.5 logging settings are per server, not per application.

Upvotes: 0

Related Questions