Our application utilized ActiveMQ 5.9.0 client. When we load up the application, I'm getting a message logged to the console stating:
log4j:WARN No appenders could be found for logger (org.apache.activemq.thread.TaskRunnerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I'm having trouble with this, becuase it seems that this is being generated by log4j 1.2, and our application uses log4j 2.7. Logging appears to work normally, but we are not seeing any logging output by the ActiveMQ client itself. A search for this issue said to run the BasicConfigurator.configure() method, but log4j 2.7 has no such method. What do I do?
How do I configure the logger for ActiveMQ Client 5.9.0?
The 5.x client is based on log4j 1.2 using the slf4j logging facade so you could possibly use some dependency magic to strip out the 1.2 impl from the client dependency when you pull it into your project and instead bring in the slf4j binding for log4j 2.
The client seems to be logging that it cannot find a log4j.properties file with configuration to allow it to add appenders so to fix that you can create a suitable log4j configuration to fix this warning.
Related
After migrating I have to configure log4j properties where in the logs i should view like this
but after enabling wire logs in log4j properties also it is not happening. what configuration i have to do to view my logs like that.
I want to log an outbound request event (whether it be to http, smb or lambda) before sending it, in debug mode in Anypoint Studio. Is that possible? If yes, how to do it?
For the Mule HTTP connector, and other connectors that use the Mule HTTP service, you can enable HTTP wire logging as you mentioned in your answer, by configuring a log4j2 logger in the log4j2.xml file of the application, or in the logging tab in Runtime Manager. Each Mule version has a specific logger. Please take a look at the KB article How to Enable HTTP Wire Logging for detailed instructions.
Specifically for Mule 4.x applications:
<Loggers>
...
<AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" level="DEBUG" />
...
</Loggers>
For other connectors you will need to check the documentation of said connectors. I'm not sure if you actually intend to debug the protocol of each connector (for example SMB requests) or just want to see if the connector is doing anything. If the former, most connector doesn't provide the same level of protocol detail as the HTTP connector. You might find it more useful to do a traffic capture and use a packet analyzer like Wireshark for that. For the later, it will depend on each connector what they can print with a logger. This KB article provides instructions for some other connectors.
Adding async logger declaration in log4j2.xml can help in this condition.
For example, I used
<Loggers>
...
<AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" level="DEBUG" />
...
</Loggers>
and it helped me for Http and aws-lambda connectors.
Previously I worked with Spring Boot and I could change logging level for concrete class without app restart due to Spring Boot actuator (just http request on loggers endpoint).
Now I'm working with ktor and I also want to change logging level at runtime.
How can I do that?
How mule decides that an event should be logged in app logs or runtime log ?
In runtime log all the logs are there even which are in app logs.
All that goes to standard output will be printed in the Mule Runtime logs (ie mule_ee.log). If the applications are configured to use stdout or console appender, then you'll get them in mule_ee.log. This is a bad practice. Applications should use their own log files. The default log4j configuration for applications created in Studio is a log per app.
I'm getting familiar with Jboss 7.
I'm writing some application to try out technologies.
So I wanted to have some simple monitoring service that will allow me to do some counter on business methods.
I wanted to access counters through jmx and jndi.
The 'counter service' is part of jmx bean. During jmx registration it is also registered in jndi context.
Then it is being used in some interceptors.
And here problem occurs, when I want to get reference from jndi I got class cast exception.
java.lang.ClassCastException: com.cybercom.pl.jbmon.SystemMonitorService cannot be cast to com.cybercom.pl.jbmon.SystemMonitorService
The reason for this i believe is that there classloaders are different.
During service startup it is:
ModuleClassLoader for Module "org.jboss.as.standalone:main" from local module loader #a4d593 ....
During execution it is:
ModuleClassLoader for Module "deployment.jboss-mon-app.ear.jboss-mon-web.war:main" from Service Module Loader
JMX beans, monitoring service and interceptor exists in same ejb module.
I finally did workaround for this, instead of going through jndi I used jmx client (https://github.com/michaljedryszka/jboss-sample-monitoring/commit/dcc4f05a4d6d50e592f0517bfe0454033f8e3659)
But still I don't know how to fix that CCE with jndi lookup.
What can You suggest?
Regards
You can try to create and install JBoss module with classes that are part of the JMX mbeans. This will cause to be loaded in same classloader for all access.
After you must add the dependency to the new module in the application, for example you can use jboss-deployment-structure.xml file.