I've finally managed to sort it out - thanks for the help.

I had to turn off the log4j logging for the axis 2 webapp, and remove the log4j jar from axis2/WEB-INF/lib folder.  After this logging worked fine - each service had its own log4j.jar - it seemed that when log4j.jar was in the axis2/WEB-INF/lib folder it was overriding the similar jars in the service.aar files.

cheers,
Anthony.

[EMAIL PROTECTED] wrote:
You could configure a different appender for each service:

# The default:
log4j.rootLogger=DEBUG, console

# service1 logs to logfile1
log4j.logger.nz.co.bcsoft.service1=debug,logfile1

# service2 logs to logfile2
log4j.logger.nz.co.bcsoft.service2=debug,logfile2

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d %p [%c] - %m%n
 
# logfile1 and logfile2 have different file names:

log4j.appender.logfile1=org.apache.log4j.RollingFileAppender
log4j.appender.logfile1.File=data-hub-auth-service1.log
log4j.appender.logfile1.MaxFileSize=20000KB
log4j.appender.logfile1.MaxBackupIndex=3
log4j.appender.logfile1.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile1.layout.ConversionPattern=%d %p [%c] - %m%n

log4j.appender.logfile2=org.apache.log4j.RollingFileAppender
log4j.appender.logfile2.File=data-hub-auth-service2.log
log4j.appender.logfile2.MaxFileSize=20000KB
log4j.appender.logfile2.MaxBackupIndex=3
log4j.appender.logfile2.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile2.layout.ConversionPattern=%d %p [%c] - %m%n


cheers,
md
 

  
-----Original Message-----
From: Anthony Bull [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2007 7:34 PM
To: [email protected]
Subject: Re: Independent Log4j logging in Axis 2 services


log4j.rootLogger=DEBUG, console, logfile

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d %p [%c] - %m%n

log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=data-hub-auth-service.log
log4j.appender.logfile.MaxFileSize=20000KB
log4j.appender.logfile.MaxBackupIndex=3
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n


[EMAIL PROTECTED] wrote:
    
Could you please post the contents of your your 
      
log4j.properties file?
    
cheers,
md
 

  
      
-----Original Message-----
From: Anthony Bull [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2007 9:34 PM
To: Martin Gainty; [email protected]
Subject: Re: Independent Log4j logging in Axis 2 services


Thanks for the reply.  All my loggers are acquired by the 
        
following 
    
(where THIS_CLASS is the current class):

Logger logger = Logger.getLogger( THIS_CLASS.class);

I'm initializing log4j with a static initializer in the 
MessageReceiverInOut class of each service, similar to the 
following code:

static {
  // log4j.
  System.out.println("log4j init");
  try {
    Properties props = new Properties();
    props.load( 
THIS_CLASS.class.getClassLoader().getResourceAsStream( 
"log4j.properties"));
    PropertyConfigurator.configure( props);
  }
  catch ( Throwable e) {
    e.printStackTrace();
  }
  finally {
    System.out.println("log4j finished");
  }
}

Both log files are created, but the last one to be created 
gets all logs 
written to it exclusively, including the Axis2 container 
        
logs such as 
    
all the "Deploying web service" messages.

cheers,
Ants.


Martin Gainty wrote:
    
        
Appears you're acquiring the rootLogger 
      
          
(Logger.getRootLogger) instead 
    
        
of NameOfLoggerYouDesire
try
Logger.getLogger(NameOfLoggerYouDesire);

      
          
http://logging.apache.org/log4j/docs/api/org/apache/log4j/Logger.html
    
    
        
M--
This email message and any files transmitted with it 
      
          
contain confidential
    
        
information intended only for the person(s) to whom this 
      
          
email message is
    
        
addressed.  If you have received this email message in 
      
          
error, please 
    
        
notify
the sender immediately by telephone or email and destroy 
      
          
the original
    
        
message without making a copy.  Thank you.

----- Original Message ----- From: "Anthony Bull" 
<[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 14, 2007 8:16 PM
Subject: Independent Log4j logging in Axis 2 services


      
          
Hi, has anyone managed to get multiple services running 
            
under the 
    
same axis2 instance to use independent log4j configurations?

I have two services, and am configuring log4j via 
            
log4j.properties 
    
files in each service - however, the first service starts 
        
            
logging to 
    
        
the log file for the second service as soon as the second 
        
            
service has 
    
        
been loaded.

cheers,
Ants.

-- 
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand

[EMAIL PROTECTED]
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
www.bcsoft.co.nz
---------------------------------------------------------------
This email may contain confidential or privileged information,
and is intended for use only by the addressee, or addressees.
If you are not the intended recipient please advise the sender
immediately and do not copy, use or disclose the contents to
any other person or organisation.
Black Coffee Software Ltd accepts no responsibility for viruses
received with this email, or to any changes made to the original
content. Any views or opinions expressed in this email may be
personal to the sender and are not necessarily those of Black
Coffee Software Ltd.
---------------------------------------------------------------




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


        
            
      
          
-- 
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand

[EMAIL PROTECTED]
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
www.bcsoft.co.nz
---------------------------------------------------------------
This email may contain confidential or privileged information,
and is intended for use only by the addressee, or addressees.
If you are not the intended recipient please advise the sender
immediately and do not copy, use or disclose the contents to
any other person or organisation.
Black Coffee Software Ltd accepts no responsibility for viruses
received with this email, or to any changes made to the original
content. Any views or opinions expressed in this email may be
personal to the sender and are not necessarily those of Black
Coffee Software Ltd.
---------------------------------------------------------------




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


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



  
      
-- 
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand

[EMAIL PROTECTED]
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
www.bcsoft.co.nz
---------------------------------------------------------------
This email may contain confidential or privileged information,
and is intended for use only by the addressee, or addressees.
If you are not the intended recipient please advise the sender
immediately and do not copy, use or disclose the contents to
any other person or organisation.
Black Coffee Software Ltd accepts no responsibility for viruses
received with this email, or to any changes made to the original
content. Any views or opinions expressed in this email may be
personal to the sender and are not necessarily those of Black
Coffee Software Ltd.
---------------------------------------------------------------



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


    

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



  


-- 
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand

[EMAIL PROTECTED]
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
www.bcsoft.co.nz
---------------------------------------------------------------
This email may contain confidential or privileged information,
and is intended for use only by the addressee, or addressees.
If you are not the intended recipient please advise the sender
immediately and do not copy, use or disclose the contents to
any other person or organisation.
Black Coffee Software Ltd accepts no responsibility for viruses
received with this email, or to any changes made to the original
content. Any views or opinions expressed in this email may be
personal to the sender and are not necessarily those of Black
Coffee Software Ltd.
---------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to