title: How to set log4j.properties in Eclipse?
body: <p>I'm trying to run <a href="http://activemq.apache.org/how-do-i-use-log4j-jms-appender-with-activemq.html" rel="noreferrer">this example</a>, but I have some problems with configuration.</p>
  
  <p>I copied <code>log4j-jms.properties</code>, <code>jndi.properties</code>, <code>Log4jJMSAppenderExample.java</code></p>
  
  <pre><code>ProjectJMS
  |
  \_ src
  |   \_ Log4jJMSAppenderExample.java
  |   \_ jndi.propeties
  \_ log4j-jms.properties
  </code></pre>
  
  <p>and run <code>activemq</code> in my console. </p>
  
  <p>When I ran my example I got </p>
  
  <pre><code>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.`PropertyConfigurator.configure("log4j-jms.properties");`
  </code></pre>
  
  <p>so I added </p>
  
  <pre><code>PropertyConfigurator.configure("log4j-jms.properties");
  </code></pre>
  
  <p>Now I can see logs in Eclipse console, but still with this warning</p>
  
  <pre><code>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.
  2012-08-13 10:21:44,741 INFO  Log4jJMSAppenderExample - Test log
  Received log [INFO]: Test log
  </code></pre>
  
  <p>and in console with <code>activemq</code> I got</p>
  
  <pre><code> WARN | Transport Connection to: tcp://127.0.0.1:2005 failed: java.net.SocketException: Connection reset
  </code></pre>
  
  <p>Why am I getting these warnings?</p>
  
  <ol>
  <li><p>Are my imports wrong? </p>
  
  <pre><code>import javax.jms.Connection;
  import javax.jms.Message;
  import javax.jms.MessageConsumer;
  import javax.jms.MessageListener;
  import javax.jms.Session;
  
  import org.apache.activemq.ActiveMQConnectionFactory;
  import org.apache.activemq.command.ActiveMQObjectMessage;
  import org.apache.log4j.Logger;
  import org.apache.log4j.PropertyConfigurator;
  import org.apache.log4j.spi.LoggingEvent;
  </code></pre></li>
  <li><p>Are my files in wrong place?</p></li>
  <li><p>How to set configuration file in Eclipse? Without using <code>PropertyConfigurator.configure("log4j-jms.properties");</code>? There is no line like this in example I follow.</p></li>
  </ol>