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

  • SEARCH
  • Home
  • 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 8353423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:15:17+00:00 2026-06-09T09:15:17+00:00

Inmy research about JMS Appenders I’ve found turorial1 and tutorial2 . I’ve tried to

  • 0

Inmy research about JMS Appenders I’ve found turorial1 and tutorial2 . I’ve tried to follow them, but I couldn’t run example program.

Fistly I created file log4j.properties

log4j.rootLogger=INFO, stdout, jms

#
log4j.logger.org.apache.activemq=INFO, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c - %m%n

#
log4j.appender.jms=org.apache.log4j.net.JMSAppender
log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
log4j.appender.jms.ProviderURL=tcp://localhost:61616
log4j.appender.jms.TopicBindingName=logTopic
log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory

and jndi.properties

topic.logTopic=logTopic

Then I added Receiver.java to my project

public class Receiver implements MessageListener {

    public Receiver() throws Exception {
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
        Connection conn = factory.createConnection();
        Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        conn.start();
        MessageConsumer consumer = sess.createConsumer(sess.createTopic("logTopic"));
        consumer.setMessageListener(this);
        Logger log = Logger.getLogger(Receiver.class);

        log.info("Test log");

        Thread.sleep(1000);
        consumer.close();
        sess.close();
        conn.close();
        System.exit(1);
    }

    public static void main(String[] args) throws Exception {
        new Receiver();
    }

    @Override
    public void onMessage(Message message) {
        try {
            // receive log event in your consumer
            LoggingEvent event = (LoggingEvent)((ActiveMQObjectMessage)message).getObject();
            System.out.println("Received log [" + event.getLevel() + "]: "+ event.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

I need make Receiver to gather all logs from project, but I cannot even run this simple example. Probably I don’t know how to configure it correctly, because I get this output:

log4j:WARN No appenders could be found for logger (org.apache.activemq.transport.WireFormatNegotiator).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Did I miss adding some lines in code or some files to classpath? I’m new to log4j.

EDIT:
I set Logger in AspectJ class. But I think that also in Receiver Logger is created and log is sent, so probably it should be done in Receiver, not in other class in my project.

static final Logger logger = Logger.getLogger(ReportingAspect.class);

@Before("setLoggingFile()")
public void setProperties() {
    PropertyConfigurator.configure("log4j.properties");
}

ProjectJMS
|
\_ src
|   \_ packages...
\_jndi.propeties
\_log4j.properties
  • 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-06-09T09:15:18+00:00Added an answer on June 9, 2026 at 9:15 am

    To configure log4j use :
    -Dlog4j.configuration= path to config file

    Path to conf file CAN be:
    À file in a path outside of classpath , if so préfix it with file:/// , example:

    • -Dlog4j.configuration=file:/c:/foobar.lcf

    Else in classpath in That case:

    • -Dlog4j.configuration=foobar.lcf where foobar.lcf is at root of your source folder

    See:

    • http://logging.apache.org/log4j/1.2/manual.html

    For jms:

    -Add jms.jar at least to classpath

    • ensure you have a JMS broker running ( activemq for example)

    Regards

    Philippe

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

Sidebar

Related Questions

In my research, I found 2 ways to do them. Both required modifications to
I have done some research about Javascript sorting algorithms performance comparison, and found unexpected
In my research about rolling back transactions in EF4, it seems everybody refers to
I think have a good feel to this based on my research but would
I have been doing some research lately about best approaches to authenticating web services
I've done some research, including here in StackOverflow, but I still have some issues
I've been doing a lot of research about handling errors with Qt/C++ and I'm
i try to program a part of a university research project about multi client
In my research each subject was given n*(n-1)/2 questions about his subjective opinion about
In my research I've come across something peculiar. @interface Class { NSString *_string }

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.