Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7415999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:24:21+00:00 2026-05-29T07:24:21+00:00

I want to connect a log4j JMSAppender to an ActiveMQ queue over Apache Camel,

  • 0

I want to connect a log4j JMSAppender to an ActiveMQ queue over Apache Camel, so that both are endpoints along a route. Furthermore, I’d like to have all the config done in Java (not XML).

The log4j javadoc here and this SO question both show great examples of how to set up such a connection sans Camel (via JNDI), but they are not quite what I am looking for.

I know this is possible through the activemq-camel Camel component, and in fact that component’s tutorial page shows how to set up a pooled connection factory to a broker URL. Unfortunately (for me) its all in XML.

I am struggling with:

  • Trying to figure out how to turn their XML examples (link above) into Java code; and
  • How to tie everything together so that the JMSAppender publishes messages over Camel to the correct queue; this involves endpoint creation and routebuilding

Here is my best attempt:

Somewhere I will need an init()-type method to set up my CamelContext:

CamelContext context = new DefaultCamelContext();

context.addComponent("log4j-jms-appender", new LogComponent()); // ????
context.addComponent("activemq", 
    activeMQComponent("vm://localhost?broker.persistent=false")); // ???

context.addRoutes(new RouteBuilder() {
    public void configure() {
        from("log4j-jms-appender").to("activemq:queue:log-queue");
    }
});

Now, there are already several problems with this code – and I may have even gone down the wrong path entirely. As you can see, I’m struggling to add the endpoint components correctly. I’m also completely unsure of what the string “vm://” protocol is or what it stands for. All the other code examples I see involve ActiveMQ utilizing the tcp protocol.

Putting it altogether, it would just be nice to write a log4j Logger and Appender like this:

Logger logger = Logger.getLogger("foo.bar");
JMSAppender jmsAppender = configureJMSAppender();

logger.addAppender(jmsAppender);

…and then have all of its log messages placed on the ActiveMQ log-queue via Camel (and not JNDI/Java).

Thanks in advance for any and all help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:24:22+00:00Added an answer on May 29, 2026 at 7:24 am

    The camel-log component doesn’t have a consumer…so you can’t wire up a route to consume from the log and send to a queue.

    One option is to configure a JMSAppender in the log4j.properties as this page describes…

    http://activemq.apache.org/how-do-i-use-log4j-jms-appender-with-activemq.html

    Also, vm:// stands for virtual machine transport…it allows you to connect to an ActiveMQ broker running in your VM…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Specifically, in VS 2008, I want to connect to a data source that you
I want to connect Microsoft Access with Turbo C++. How can I do that?
I want to connect to rss website that secured with username and password. I
I want to connect to a MySQL database that is installed on a linux
I want to connect my db on SQL Server 2008 over local area network
I want to connect to ssh and type in a command that will show
I want to connect and execute one (or sometimes several) SQL statements, and NOT
I want to connect to DB using the iSeries Client Access driver. I use
I want to connect a single ForeignKey to two different models. For example: I
I want to connect from home using SQL Server 2005 to another PC. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.