Topic
No replies
2BS5_Anuroop_Sirothia
1 Post
ACCEPTED ANSWER

Pinned topic How to log messages to multiple log files?

‏2014-02-07T12:16:25Z |

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 <logging> 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:http://stackoverflow.com/questions/14506902/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.

 

Thanks,

-Anuroop.