axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Bull <anthony.b...@bcsoft.co.nz>
Subject Re: Independent Log4j logging in Axis 2 services [SOLVED]
Date Thu, 16 Aug 2007 21:02:10 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I've finally managed to sort it out - thanks for the help.<br>
<br>
I had to turn off the log4j logging for the axis 2 webapp, and remove
the log4j jar from axis2/WEB-INF/lib folder.&nbsp; 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.<br>
<br>
cheers,<br>
Anthony.<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Michael.Davis@servicecanada.gc.ca">Michael.Davis@servicecanada.gc.ca</a>
wrote:
<blockquote
 cite="mid70786C90113B6D4C89A76D69F151A041BE2C02@ONEV01.hrdc-drhc.net"
 type="cite">
  <pre wrap="">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
 

  </pre>
  <blockquote type="cite">
    <pre wrap="">-----Original Message-----
From: Anthony Bull [<a class="moz-txt-link-freetext" href="mailto:anthony.bull@bcsoft.co.nz">mailto:anthony.bull@bcsoft.co.nz</a>]
Sent: Wednesday, August 15, 2007 7:34 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:axis-user@ws.apache.org">axis-user@ws.apache.org</a>
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


<a class="moz-txt-link-abbreviated" href="mailto:Michael.Davis@servicecanada.gc.ca">Michael.Davis@servicecanada.gc.ca</a>
wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Could you please post the contents of your your 
      </pre>
    </blockquote>
    <pre wrap="">log4j.properties file?
    </pre>
    <blockquote type="cite">
      <pre wrap="">cheers,
md
 

  
      </pre>
      <blockquote type="cite">
        <pre wrap="">-----Original Message-----
From: Anthony Bull [<a class="moz-txt-link-freetext" href="mailto:anthony.bull@bcsoft.co.nz">mailto:anthony.bull@bcsoft.co.nz</a>]
Sent: Tuesday, August 14, 2007 9:34 PM
To: Martin Gainty; <a class="moz-txt-link-abbreviated" href="mailto:axis-user@ws.apache.org">axis-user@ws.apache.org</a>
Subject: Re: Independent Log4j logging in Axis 2 services


Thanks for the reply.  All my loggers are acquired by the 
        </pre>
      </blockquote>
    </blockquote>
    <pre wrap="">following 
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">(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 
        </pre>
      </blockquote>
    </blockquote>
    <pre wrap="">logs such as 
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">all the "Deploying web service" messages.

cheers,
Ants.


Martin Gainty wrote:
    
        </pre>
        <blockquote type="cite">
          <pre wrap="">Appears you're acquiring the rootLogger 
      
          </pre>
        </blockquote>
        <pre wrap="">(Logger.getRootLogger) instead 
    
        </pre>
        <blockquote type="cite">
          <pre wrap="">of NameOfLoggerYouDesire
try
Logger.getLogger(NameOfLoggerYouDesire);

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

----- Original Message ----- From: "Anthony Bull" 
<a class="moz-txt-link-rfc2396E" href="mailto:anthony.bull@bcsoft.co.nz">&lt;anthony.bull@bcsoft.co.nz&gt;</a>
To: <a class="moz-txt-link-rfc2396E" href="mailto:axis-user@ws.apache.org">&lt;axis-user@ws.apache.org&gt;</a>
Sent: Tuesday, August 14, 2007 8:16 PM
Subject: Independent Log4j logging in Axis 2 services


      
          </pre>
          <blockquote type="cite">
            <pre wrap="">Hi, has anyone managed to get multiple services running 
            </pre>
          </blockquote>
        </blockquote>
      </blockquote>
    </blockquote>
    <pre wrap="">under the 
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">same axis2 instance to use independent log4j configurations?

I have two services, and am configuring log4j via 
            </pre>
          </blockquote>
        </blockquote>
      </blockquote>
    </blockquote>
    <pre wrap="">log4j.properties 
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">files in each service - however, the first service starts 
        
            </pre>
          </blockquote>
        </blockquote>
        <pre wrap="">logging to 
    
        </pre>
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">the log file for the second service as soon as the second 
        
            </pre>
          </blockquote>
        </blockquote>
        <pre wrap="">service has 
    
        </pre>
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">been loaded.

cheers,
Ants.

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

<a class="moz-txt-link-abbreviated" href="mailto:anthony.bull@bcsoft.co.nz">anthony.bull@bcsoft.co.nz</a>
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
<a class="moz-txt-link-abbreviated" href="http://www.bcsoft.co.nz">www.bcsoft.co.nz</a>
---------------------------------------------------------------
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.
---------------------------------------------------------------




        
            </pre>
          </blockquote>
        </blockquote>
      </blockquote>
    </blockquote>
    <pre wrap="">---------------------------------------------------------------------
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">    
        </pre>
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated"
href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>


        
            </pre>
          </blockquote>
          <pre wrap="">      
          </pre>
        </blockquote>
        <pre wrap="">-- 
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand

<a class="moz-txt-link-abbreviated" href="mailto:anthony.bull@bcsoft.co.nz">anthony.bull@bcsoft.co.nz</a>
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
<a class="moz-txt-link-abbreviated" href="http://www.bcsoft.co.nz">www.bcsoft.co.nz</a>
---------------------------------------------------------------
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.
---------------------------------------------------------------




        </pre>
      </blockquote>
    </blockquote>
    <pre wrap="">---------------------------------------------------------------------
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated"
href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>


    
        </pre>
      </blockquote>
      <pre wrap="">
      </pre>
    </blockquote>
    <pre wrap="">---------------------------------------------------------------------
    </pre>
    <blockquote type="cite">
      <pre wrap="">To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>



  
      </pre>
    </blockquote>
    <pre wrap="">
-- 
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand

<a class="moz-txt-link-abbreviated" href="mailto:anthony.bull@bcsoft.co.nz">anthony.bull@bcsoft.co.nz</a>
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
<a class="moz-txt-link-abbreviated" href="http://www.bcsoft.co.nz">www.bcsoft.co.nz</a>
---------------------------------------------------------------
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: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>



  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand

<a class="moz-txt-link-abbreviated" href="mailto:anthony.bull@bcsoft.co.nz">anthony.bull@bcsoft.co.nz</a>
Ph  +64 4 472 8818
Fax +64 4 472 8811
Mobile 021 303 692
-------------------------------------
<a class="moz-txt-link-abbreviated" href="http://www.bcsoft.co.nz">www.bcsoft.co.nz</a>
---------------------------------------------------------------
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.
---------------------------------------------------------------
</pre>
</body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message