You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Mike Tod <mt...@foundationmedicine.com> on 2016/03/24 16:10:57 UTC

JMSAppender

Has anyone been able to get the JMSAppender working on Log4j2?

If so do you have any example config?

Below is my config file :

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
  <Appenders>

    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
    </Console>

   <File name="LogFile" fileName="c:/temp/ReportGenerationTesting/Logs/appjms.log">
      <PatternLayout>
        <Pattern>%d{HH:mm:ss.SSS} %-5level %c{1.} %M:%L - %msg%xEx%n</Pattern>
      </PatternLayout>
    </File>

    <JMS name="jmsQueue"
          factoryName="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
          factoryBindingName="ConnectionFactory"
          providerURL="tcp://localhost:61616"
          destinationBindingName ="jmsTest"
          userName="admin"
          password="admin"
    />

  </Appenders>
  <Loggers>
    <Root level="trace">
      <AppenderRef ref="Console"/>
      <AppenderRef ref="LogFile"/>
        <AppenderRef ref="jmsQueue"/>
    </Root>
  </Loggers>
</Configuration>


I keep getting the following errors.

2016-03-24 07:24:03,159 main ERROR Error creating JmsManager using ConnectionFactory [ConnectionFactory] and Destination [jmsTest].
2016-03-24 07:24:03,161 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.mom.JmsAppender, element JMSQueue.
2016-03-24 07:24:03,161 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.mom.JmsAppender for element JMSQueue.
2016-03-24 07:24:03,162 main ERROR Null object returned for JMSQueue in Appenders.
2016-03-24 07:24:03,168 main ERROR Unable to locate appender "jmsQueue" for logger config "root"

Thanks

Mike


This communication and any files transmitted with it may contain information that is considered to be confidential, privileged and exempt from disclosure under applicable law. This message is intended for Foundation Medicine-affiliated use and that of the intended recipient only and may contain information that is protected by Foundation Medicine policies and the HIPAA Privacy Rule, 45 CFR � 164.500. This communication is intended solely for the use of intended recipient. If you are not the intended recipient, you are hereby notified that any use, dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately and delete this message immediately. Thank you for your cooperation.

Re: JMSAppender

Posted by Gary Gregory <ga...@gmail.com>.
Weird, I see "Unable to inject fields into builder" in our sources but
there should be an exception in the log too.

Are you using the latest version?

Gary

On Thu, Mar 24, 2016 at 8:10 AM, Mike Tod <mt...@foundationmedicine.com>
wrote:

> Has anyone been able to get the JMSAppender working on Log4j2?
>
> If so do you have any example config?
>
> Below is my config file :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="WARN">
>   <Appenders>
>
>     <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M -
> %msg%xEx%n"/>
>     </Console>
>
>    <File name="LogFile"
> fileName="c:/temp/ReportGenerationTesting/Logs/appjms.log">
>       <PatternLayout>
>         <Pattern>%d{HH:mm:ss.SSS} %-5level %c{1.} %M:%L -
> %msg%xEx%n</Pattern>
>       </PatternLayout>
>     </File>
>
>     <JMS name="jmsQueue"
>
> factoryName="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
>           factoryBindingName="ConnectionFactory"
>           providerURL="tcp://localhost:61616"
>           destinationBindingName ="jmsTest"
>           userName="admin"
>           password="admin"
>     />
>
>   </Appenders>
>   <Loggers>
>     <Root level="trace">
>       <AppenderRef ref="Console"/>
>       <AppenderRef ref="LogFile"/>
>         <AppenderRef ref="jmsQueue"/>
>     </Root>
>   </Loggers>
> </Configuration>
>
>
> I keep getting the following errors.
>
> 2016-03-24 07:24:03,159 main ERROR Error creating JmsManager using
> ConnectionFactory [ConnectionFactory] and Destination [jmsTest].
> 2016-03-24 07:24:03,161 main ERROR Unable to inject fields into builder
> class for plugin type class
> org.apache.logging.log4j.core.appender.mom.JmsAppender, element JMSQueue.
> 2016-03-24 07:24:03,161 main ERROR Unable to invoke factory method in
> class class org.apache.logging.log4j.core.appender.mom.JmsAppender for
> element JMSQueue.
> 2016-03-24 07:24:03,162 main ERROR Null object returned for JMSQueue in
> Appenders.
> 2016-03-24 07:24:03,168 main ERROR Unable to locate appender "jmsQueue"
> for logger config "root"
>
> Thanks
>
> Mike
>
>
> This communication and any files transmitted with it may contain
> information that is considered to be confidential, privileged and exempt
> from disclosure under applicable law. This message is intended for
> Foundation Medicine-affiliated use and that of the intended recipient only
> and may contain information that is protected by Foundation Medicine
> policies and the HIPAA Privacy Rule, 45 CFR § 164.500. This communication
> is intended solely for the use of intended recipient. If you are not the
> intended recipient, you are hereby notified that any use, dissemination or
> copying of this communication is strictly prohibited. If you have received
> this communication in error, please notify the sender immediately and
> delete this message immediately. Thank you for your cooperation.
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: JMSAppender

Posted by Gary Gregory <ga...@gmail.com>.
You could look at how our unit tests work and compare to your set up.

Gary

On Thu, Mar 24, 2016 at 8:10 AM, Mike Tod <mt...@foundationmedicine.com>
wrote:

> Has anyone been able to get the JMSAppender working on Log4j2?
>
> If so do you have any example config?
>
> Below is my config file :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="WARN">
>   <Appenders>
>
>     <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M -
> %msg%xEx%n"/>
>     </Console>
>
>    <File name="LogFile"
> fileName="c:/temp/ReportGenerationTesting/Logs/appjms.log">
>       <PatternLayout>
>         <Pattern>%d{HH:mm:ss.SSS} %-5level %c{1.} %M:%L -
> %msg%xEx%n</Pattern>
>       </PatternLayout>
>     </File>
>
>     <JMS name="jmsQueue"
>
> factoryName="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
>           factoryBindingName="ConnectionFactory"
>           providerURL="tcp://localhost:61616"
>           destinationBindingName ="jmsTest"
>           userName="admin"
>           password="admin"
>     />
>
>   </Appenders>
>   <Loggers>
>     <Root level="trace">
>       <AppenderRef ref="Console"/>
>       <AppenderRef ref="LogFile"/>
>         <AppenderRef ref="jmsQueue"/>
>     </Root>
>   </Loggers>
> </Configuration>
>
>
> I keep getting the following errors.
>
> 2016-03-24 07:24:03,159 main ERROR Error creating JmsManager using
> ConnectionFactory [ConnectionFactory] and Destination [jmsTest].
> 2016-03-24 07:24:03,161 main ERROR Unable to inject fields into builder
> class for plugin type class
> org.apache.logging.log4j.core.appender.mom.JmsAppender, element JMSQueue.
> 2016-03-24 07:24:03,161 main ERROR Unable to invoke factory method in
> class class org.apache.logging.log4j.core.appender.mom.JmsAppender for
> element JMSQueue.
> 2016-03-24 07:24:03,162 main ERROR Null object returned for JMSQueue in
> Appenders.
> 2016-03-24 07:24:03,168 main ERROR Unable to locate appender "jmsQueue"
> for logger config "root"
>
> Thanks
>
> Mike
>
>
> This communication and any files transmitted with it may contain
> information that is considered to be confidential, privileged and exempt
> from disclosure under applicable law. This message is intended for
> Foundation Medicine-affiliated use and that of the intended recipient only
> and may contain information that is protected by Foundation Medicine
> policies and the HIPAA Privacy Rule, 45 CFR § 164.500. This communication
> is intended solely for the use of intended recipient. If you are not the
> intended recipient, you are hereby notified that any use, dissemination or
> copying of this communication is strictly prohibited. If you have received
> this communication in error, please notify the sender immediately and
> delete this message immediately. Thank you for your cooperation.
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory