Hi to all, 
(This is a little longish, but I had to add words to make things clear.
We are stuck. 
Please read till the end).


***********
Question :
***********
How to use more that 1 configuration file in 1 app :


***********
Problem : 
***********
PropertyConfigurator.configure(.) overwrites previous choices


***********
Usage :
***********
We are building a simple log relayer/dispatcher, that listens on 
socket ports, and relays/resends incoming logEvents with log4j,
to other log4j appenders, or even another relaye.


Each port is dedicated to 1 client application.

ex : 
   port 2010 = logs coming from app "x1"
   port 2011 = logs coming from app "x2"


Obviously, the logging requirements are not the same for each app.,
so we want to use 1 log4j configuration file for each app/port

ex : 
   conf_2010.log4j = log4j instructions to relay app "x1" logEvents
   conf_2011.log4j = log4j instructions to relay app "x1" logEvents

***********
Problem : 
***********
PropertyConfigurator.configure(.) is static, and 
overwrites previous choices


***********
How to reproduce
***********

with 

file: conf_2010.log4j :
---------------------- 
    ...
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    og4j.appender.stdout.layout.ConversionPattern=***********%m%n
    ...

file: conf_2011.log4j :
---------------------- 
    (idem but for :
    og4j.appender.stdout.layout.ConversionPattern=------------%m%n


test code : 
--------------------
  public class spike () {
    public static void main (..){
    //
        PropertyConfigurator.configureAndWatch( file1_tirets );
        cat1 = Category.getInstance("cat1");
        cat1 .debug("text 1");

    //
        PropertyConfigurator.configureAndWatch( file2_stars );
        cat2 = Category.getInstance("cat2");
        cat2 .debug("text 2");

        cat1 .debug("text 1");
        cat2 .debug("text 2");

     }
   }


Result :
       ***********text1
       -----------text2
       -----------text1
       -----------text2

I want to obtain :


       ***********text1
       -----------text2
       ***********text1
       -----------text2



Is there a solution to this problem?
We are stuck.
Thanks in advance

Alain Ravet
Brussels, Belgium

This mail has been checked by exiscan.
To be safe, please scan the mail attachements with your local virus scanner !

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to