You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Ben Stover <bx...@yahoo.co.uk> on 2010/09/03 12:13:31 UTC

How to use a second,own log4j.properties for a bean?

I deployed a (MD)Bean to the /lib subfolder of ActiveMQ and configured the activemq.xml accordingly.

The Bean runs successfully. As a side operation it does some logging which should be directed
to a second, separate logfile (e.g. $ACTIVEMQ_HOME/data/mylogfile123.log).

So it cannot use the default ActiveMQ log4j.properties file in subfolder /conf.
Instead I tried to add a second, own log4j.properties file into the deployed *.jar Bean.
I epected that the special log4j.properties file has priority over the default one.

Unfortunately this does not work. The output goes still to the logfile defined in the
default log4j.properties file.

According to

http://logging.apache.org/log4j/1.2/manual.html#defaultInit

I defined a 

  <property name="resouce" value="log4j.properties">

entry in activemq.xml inside the SpringXML bean declaration.
But his does not help either.
  
How can I setup a second log4j.properties file for a new Bean?

Maybe there are some other configuration tricks to get the log4j working.

Ben



Re: How to use a second,own log4j.properties for a bean?

Posted by Dejan Bosanac <de...@nighttale.net>.
You can configure your bean to log to the other file in the same
log4j.properties file ActiveMQ uses. You just need to define a new
appender and configure your logs to write there.


Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net



On Fri, Sep 3, 2010 at 12:13 PM, Ben Stover <bx...@yahoo.co.uk> wrote:
> I deployed a (MD)Bean to the /lib subfolder of ActiveMQ and configured the activemq.xml accordingly.
>
> The Bean runs successfully. As a side operation it does some logging which should be directed
> to a second, separate logfile (e.g. $ACTIVEMQ_HOME/data/mylogfile123.log).
>
> So it cannot use the default ActiveMQ log4j.properties file in subfolder /conf.
> Instead I tried to add a second, own log4j.properties file into the deployed *.jar Bean.
> I epected that the special log4j.properties file has priority over the default one.
>
> Unfortunately this does not work. The output goes still to the logfile defined in the
> default log4j.properties file.
>
> According to
>
> http://logging.apache.org/log4j/1.2/manual.html#defaultInit
>
> I defined a
>
>  <property name="resouce" value="log4j.properties">
>
> entry in activemq.xml inside the SpringXML bean declaration.
> But his does not help either.
>
> How can I setup a second log4j.properties file for a new Bean?
>
> Maybe there are some other configuration tricks to get the log4j working.
>
> Ben
>
>
>