You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Michele Mazzucco <Mi...@ncl.ac.uk> on 2006/07/20 15:26:08 UTC

[Axis2] log4j configuration issue

Hi all,

where should I put the log4j.properties file into my axis2 web service?
And how do I locate it?


Thanks in advance,
Michele

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


Re: [Axis2] log4j configuration issue

Posted by robert lazarski <ro...@gmail.com>.
Log4j automatically looks for properties files in the classloader. You
can configure log4j to look for its config as you did, but it does
have some default locations to look for it.

HTH,
Robert
http://www.braziloutsource.com/

On 7/21/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
> And what about the logging configuration? The
> PropertyConfiguration.configure() call needs an argument: what do you
> pass to it? Or you don't need that call?
>
> Michele
>
> On 21 Jul 2006, at 13:19, robert lazarski wrote:
>
> > That's the hard way ;-) . I typically put log4j.jar in my WEB-INF/lib
> > as the classloader issues can get tricky. If you put the contents of
> > this in your log4j properties under WEB-INF/classes, log4j will find
> > it and you'll get debug output into catalina.out :
> >
> >
> > ##################INICIO DOS APPENDERs################################
> >
> > #-------------------------------------------------------------------#
> > #-------------------------------------------------------------------#
> >
> > # console2 será um appender de console que exibirá todas as
> > propriedades
> > log4j.appender.console2=org.apache.log4j.ConsoleAppender
> >
> > log4j.appender.console2.layout=org.apache.log4j.PatternLayout
> > log4j.appender.console2.layout.ConversionPattern=%d [%c] - %m%n
> >
> > #-------------------------------------------------------------------#
> > #################INICIO DO ROOTlOGGER################################
> >
> > log4j.rootLogger=DEBUG, console2
> >
> > ###################FIM DO ROOTlOGGER################################
> >
> >
> > #############INICIO DAS DECLARAÇÕES DE CATEGORIAS####################
> >
> > log4j.category.org.apache=DEBUG, console2
> >
> > HTH,
> > Robert
> > http://www.braziloutsource.com/
> >
> >
> > On 7/21/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
> >> Robert,
> >>
> >> robert lazarski wrote:
> >> > WEB-INF/classes .
> >>
> >> I've tried it, but unfortunately it didn't work. Instead, I've
> >> fixed the
> >> problem this way:
> >>
> >> 1 - I've put log4j.properties into the archive root
> >>
> >> 2 - I got the class loader for the service class
> >> ClassLoader loader = EntropyAnalyserService.class.getClassLoader();
> >>
> >> 3 - Using the class loader, I got the url to the file (from the root)
> >> URL url = loader.getResource("/log4j.properties");
> >>
> >>
> >> Make sure you have log4j.jar under WEB-INF/lib or
> >> > another appropriate place.
> >>
> >>
> >> Since log4j.jar is in $CATALINA_HOME/common/lib I don't need to
> >> include
> >> it into WEB-INF/lib, do I?
> >>
> >> Thanks,
> >> Michele
> >>
> >> >
> >> > HTH,
> >> > Robert
> >> > http://www.braziloutsource.com/
> >> >
> >> > On 7/20/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
> >> >> Hi all,
> >> >>
> >> >> where should I put the log4j.properties file into my axis2 web
> >> service?
> >> >> And how do I locate it?
> >> >>
> >> >>
> >> >> Thanks in advance,
> >> >> Michele
> >> >>
> >> >>
> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

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


Re: [Axis2] log4j configuration issue

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
And what about the logging configuration? The  
PropertyConfiguration.configure() call needs an argument: what do you  
pass to it? Or you don't need that call?

Michele

On 21 Jul 2006, at 13:19, robert lazarski wrote:

> That's the hard way ;-) . I typically put log4j.jar in my WEB-INF/lib
> as the classloader issues can get tricky. If you put the contents of
> this in your log4j properties under WEB-INF/classes, log4j will find
> it and you'll get debug output into catalina.out :
>
>
> ##################INICIO DOS APPENDERs################################
>
> #-------------------------------------------------------------------#
> #-------------------------------------------------------------------#
>
> # console2 será um appender de console que exibirá todas as  
> propriedades
> log4j.appender.console2=org.apache.log4j.ConsoleAppender
>
> log4j.appender.console2.layout=org.apache.log4j.PatternLayout
> log4j.appender.console2.layout.ConversionPattern=%d [%c] - %m%n
>
> #-------------------------------------------------------------------#
> #################INICIO DO ROOTlOGGER################################
>
> log4j.rootLogger=DEBUG, console2
>
> ###################FIM DO ROOTlOGGER################################
>
>
> #############INICIO DAS DECLARAÇÕES DE CATEGORIAS####################
>
> log4j.category.org.apache=DEBUG, console2
>
> HTH,
> Robert
> http://www.braziloutsource.com/
>
>
> On 7/21/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
>> Robert,
>>
>> robert lazarski wrote:
>> > WEB-INF/classes .
>>
>> I've tried it, but unfortunately it didn't work. Instead, I've  
>> fixed the
>> problem this way:
>>
>> 1 - I've put log4j.properties into the archive root
>>
>> 2 - I got the class loader for the service class
>> ClassLoader loader = EntropyAnalyserService.class.getClassLoader();
>>
>> 3 - Using the class loader, I got the url to the file (from the root)
>> URL url = loader.getResource("/log4j.properties");
>>
>>
>> Make sure you have log4j.jar under WEB-INF/lib or
>> > another appropriate place.
>>
>>
>> Since log4j.jar is in $CATALINA_HOME/common/lib I don't need to  
>> include
>> it into WEB-INF/lib, do I?
>>
>> Thanks,
>> Michele
>>
>> >
>> > HTH,
>> > Robert
>> > http://www.braziloutsource.com/
>> >
>> > On 7/20/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
>> >> Hi all,
>> >>
>> >> where should I put the log4j.properties file into my axis2 web  
>> service?
>> >> And how do I locate it?
>> >>
>> >>
>> >> Thanks in advance,
>> >> Michele
>> >>
>> >>  
>> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>
>> >>
>> >
>> >  
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>


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


Re: [Axis2] log4j configuration issue

Posted by robert lazarski <ro...@gmail.com>.
That's the hard way ;-) . I typically put log4j.jar in my WEB-INF/lib
as the classloader issues can get tricky. If you put the contents of
this in your log4j properties under WEB-INF/classes, log4j will find
it and you'll get debug output into catalina.out :


##################INICIO DOS APPENDERs################################

#-------------------------------------------------------------------#
#-------------------------------------------------------------------#

# console2 será um appender de console que exibirá todas as propriedades
log4j.appender.console2=org.apache.log4j.ConsoleAppender

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

#-------------------------------------------------------------------#
#################INICIO DO ROOTlOGGER################################

log4j.rootLogger=DEBUG, console2

###################FIM DO ROOTlOGGER################################


#############INICIO DAS DECLARAÇÕES DE CATEGORIAS####################

log4j.category.org.apache=DEBUG, console2

HTH,
Robert
http://www.braziloutsource.com/


On 7/21/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
> Robert,
>
> robert lazarski wrote:
> > WEB-INF/classes .
>
> I've tried it, but unfortunately it didn't work. Instead, I've fixed the
> problem this way:
>
> 1 - I've put log4j.properties into the archive root
>
> 2 - I got the class loader for the service class
> ClassLoader loader = EntropyAnalyserService.class.getClassLoader();
>
> 3 - Using the class loader, I got the url to the file (from the root)
> URL url = loader.getResource("/log4j.properties");
>
>
> Make sure you have log4j.jar under WEB-INF/lib or
> > another appropriate place.
>
>
> Since log4j.jar is in $CATALINA_HOME/common/lib I don't need to include
> it into WEB-INF/lib, do I?
>
> Thanks,
> Michele
>
> >
> > HTH,
> > Robert
> > http://www.braziloutsource.com/
> >
> > On 7/20/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
> >> Hi all,
> >>
> >> where should I put the log4j.properties file into my axis2 web service?
> >> And how do I locate it?
> >>
> >>
> >> Thanks in advance,
> >> Michele
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

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


Re: [Axis2] log4j configuration issue

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Robert,

robert lazarski wrote:
> WEB-INF/classes . 

I've tried it, but unfortunately it didn't work. Instead, I've fixed the
problem this way:

1 - I've put log4j.properties into the archive root

2 - I got the class loader for the service class
ClassLoader loader = EntropyAnalyserService.class.getClassLoader();

3 - Using the class loader, I got the url to the file (from the root)
URL url = loader.getResource("/log4j.properties");


Make sure you have log4j.jar under WEB-INF/lib or
> another appropriate place.


Since log4j.jar is in $CATALINA_HOME/common/lib I don't need to include
it into WEB-INF/lib, do I?

Thanks,
Michele

> 
> HTH,
> Robert
> http://www.braziloutsource.com/
> 
> On 7/20/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
>> Hi all,
>>
>> where should I put the log4j.properties file into my axis2 web service?
>> And how do I locate it?
>>
>>
>> Thanks in advance,
>> Michele
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

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


Re: [Axis2] log4j configuration issue

Posted by robert lazarski <ro...@gmail.com>.
WEB-INF/classes . Make sure you have log4j.jar under WEB-INF/lib or
another appropriate place.

HTH,
Robert
http://www.braziloutsource.com/

On 7/20/06, Michele Mazzucco <Mi...@ncl.ac.uk> wrote:
> Hi all,
>
> where should I put the log4j.properties file into my axis2 web service?
> And how do I locate it?
>
>
> Thanks in advance,
> Michele
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

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