You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sub3 <st...@subwest.com> on 2008/02/07 02:26:59 UTC

Using Camel & Log4j on Multiple Machines

I am current logging everything using log4j directly to files on the local
machine.  Now that I am using Camel and going across multiple machines, I
would like my logs to remain on each local machine, but anything above
warning to also go to a designated machine.

I was wondering if anyone did this and what was their approach.
I could do it all directly with log4j & sockets. But why not use
Camel/ActiveMQ.  I was wondering if it would be better just to extend the
loggers for this, or to build an appender which would push the messages back
into a topic?

Any advice?
Thanks.
-- 
View this message in context: http://www.nabble.com/Using-Camel---Log4j-on-Multiple-Machines-tp15325689s22882p15325689.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Log4j Appender

Posted by Guillaume Nodet <gn...@gmail.com>.
In case you deploy camel in karaf, camel already defines a custom
pax-logging appender which intercepts all log events (slf4j, log4j,
jul, jcl) and can process them.
See http://camel.apache.org/pax-logging.html

On Thu, Apr 14, 2011 at 14:49, Claus Ibsen <cl...@gmail.com> wrote:
> Yeah this can be tricky as you would have different classloaders and whatnot.
> Also the log4j could be shared among different Camel applications.
>
> You can use a remote transport of some sort, and send data over HTTP.
>
> However if you run in Karaf, then pax-logging, may have some osgi
> related stuff you can leverage.
>
>
> On Thu, Apr 14, 2011 at 2:17 PM, Gert Villemos <gv...@yahoo.de> wrote:
>> Creating a custom log4j appender is very easy (... indeed we have one but we
>> are not happy with it as it only injects into ActiveMQ and not into a Camel
>> route).
>>
>> Our only problem (and this is now turning into a developer question more
>> than a user question) is how can the custom Appender which is a part of the
>> log4j hierarchy get a reference to a route producer template?
>>
>> If we for example
>>
>> 1. Configure an instance of the custom appender and using the
>> log4j.properties / log4j.xml file configure it to inject into the route
>> "direct:logs".
>>
>> 2. Configure a Camel route 'from("direct:logs").to("activemq:topic:logs)'
>>
>> How do we in the log4j Appender get a reference to the ProducerTemplate with
>> the identifier 'direct:logs'?
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302852.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> CamelOne 2011: http://fusesource.com/camelone2011/
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com/

Re: Camel Log4j Appender

Posted by Claus Ibsen <cl...@gmail.com>.
Yeah this can be tricky as you would have different classloaders and whatnot.
Also the log4j could be shared among different Camel applications.

You can use a remote transport of some sort, and send data over HTTP.

However if you run in Karaf, then pax-logging, may have some osgi
related stuff you can leverage.


On Thu, Apr 14, 2011 at 2:17 PM, Gert Villemos <gv...@yahoo.de> wrote:
> Creating a custom log4j appender is very easy (... indeed we have one but we
> are not happy with it as it only injects into ActiveMQ and not into a Camel
> route).
>
> Our only problem (and this is now turning into a developer question more
> than a user question) is how can the custom Appender which is a part of the
> log4j hierarchy get a reference to a route producer template?
>
> If we for example
>
> 1. Configure an instance of the custom appender and using the
> log4j.properties / log4j.xml file configure it to inject into the route
> "direct:logs".
>
> 2. Configure a Camel route 'from("direct:logs").to("activemq:topic:logs)'
>
> How do we in the log4j Appender get a reference to the ProducerTemplate with
> the identifier 'direct:logs'?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302852.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Camel Log4j Appender

Posted by Gert Villemos <gv...@yahoo.de>.
Creating a custom log4j appender is very easy (... indeed we have one but we
are not happy with it as it only injects into ActiveMQ and not into a Camel
route).

Our only problem (and this is now turning into a developer question more
than a user question) is how can the custom Appender which is a part of the
log4j hierarchy get a reference to a route producer template?

If we for example 

1. Configure an instance of the custom appender and using the
log4j.properties / log4j.xml file configure it to inject into the route
"direct:logs".

2. Configure a Camel route 'from("direct:logs").to("activemq:topic:logs)'

How do we in the log4j Appender get a reference to the ProducerTemplate with
the identifier 'direct:logs'?

--
View this message in context: http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302852.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Log4j Appender

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Apr 14, 2011 at 1:27 PM, Gert Villemos <gv...@yahoo.de> wrote:
> Did this issue moved forward?
>
> I can find a log4j JMS logger that can inject data into an ActiveMQ, but I
> would like to inject events into a camel route which might go to ActiveMQ,
> but might also have other steps.
>
> Can this be done?

Yeah I think log4j has a plugin API for appenders.
You should check log4j documentation.

And as you know we love contributions so if you go about developing
such an appender, then consider donating it to Apache.


>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302784.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Camel Log4j Appender

Posted by Gert Villemos <gv...@yahoo.de>.
Did this issue moved forward? 

I can find a log4j JMS logger that can inject data into an ActiveMQ, but I
would like to inject events into a camel route which might go to ActiveMQ,
but might also have other steps.

Can this be done?

--
View this message in context: http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302784.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using Camel & Log4j on Multiple Machines

Posted by James Strachan <ja...@gmail.com>.
On 07/02/2008, sub3 <st...@subwest.com> wrote:
>
> I am current logging everything using log4j directly to files on the local
> machine.  Now that I am using Camel and going across multiple machines, I
> would like my logs to remain on each local machine, but anything above
> warning to also go to a designated machine.
>
> I was wondering if anyone did this and what was their approach.
> I could do it all directly with log4j & sockets. But why not use
> Camel/ActiveMQ.  I was wondering if it would be better just to extend the
> loggers for this, or to build an appender which would push the messages back
> into a topic?

Good idea :)

I guess we could write a log4j appender that takes a Camel URI to
route to? Folks could even use a Content Based Router if they wanted
to etc.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com