How to add an log file into Keycloak provider jar - jboss

I have created a provider jar for catching event in Keycloak. I would like to write logs using log4j2.xml.
I added log4j2.xml file under Resource/META-INF folder. After I deployed the jar in Keycloak I'm getting an error saying "ERROR StatusLogger No log4j2 configuration file found." Attaching my project structure
Do I need to specify log4j2.xml somewhere else?

Related

How to create separate log files for every jar that present in war file in JBOSS EAP/Wildfly

I have deployed one war file in JBOSS eap7.4, but all my logs are going to server.log file by default. I have 2 jars in my war file for which I need to log messages in separate files. Please help me.
This is the custom handler I have created in standalone.xml
And this is the module.xml
This is my log4j.xml file to implement logs for 2 jars with their package names
You need to exclude the org.apache.logging.api from your deployment in a jboss-deployment-structure.xml file. Then include both the log4j-api and log4j-core libraries in your deployment if you want to use a log4j2 configuration file. See the JBoss EAP 7.4 documentation for more details.
You need to achieve this using logging profiles. Please refer
https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/6.4/html/administration_and_configuration_guide/sect-logging_profiles

In activiti business rule task java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter

In activiti business rule task while deploying I'm getting the following error.
java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter
I've added the jar file in the WEB-INF/lib folder and then I deployed the .bar file but then also i'm getting this error for activiti-explorer.
In wso2 bps also I deployed the jar file in repository/components/lib directory and after restarting I deployed the .bar file same exception I got.
You need to make sure that you have Drools in the classpath, can you see any drools jar inside the WEB-INF/lib directory? It sounds like that is the only thing missing if you are getting that exception.

CXF log File issue in Jboss6

cxf log is not getting populated in the applications when trying to migrate my application to Jboss6 from Jboss5.Issue is resolved by adding a file named org.apache.cxf.Logger in /META-INF/cxf folder structure.is this is the only solution ? and I want to know that what is forcing us to add this file in META-INF

How can I get Websphere to find persistence.xml in a jar file rather than META-INF?

I'm building a set of REST services and deploying each service to a separate WAR file. Since each of these services uses the exact same persistence configuration, I've placed my persistence.xml in a jar file (the path of the persistence.xml file in the jar is still /META-INF).
When running this using TomEE (1.7), this works just fine. However, when I try the same thing with WebSphere (8.5.5.x) my persistence units do not get loaded. In the WebSphere log, I get an error that looks like:
[4/27/16 8:54:21:653 EDT] 00000080 JPAApplInfo E CWWJP0029E: The server cannot find the MRO_PU_JTA persistence unit in the Customer_WAR.war module and the DS_APP_EAR application.
[4/27/16 8:54:21:654 EDT] 00000080 InjectionBind E CWNEN0035E: The ds.services.helper.AbstractServiceHelper/em reference of type javax.persistence.EntityManager for the component in the Customer_WAR.war module of the DS_APP_EAR application cannot be resolved.
[4/27/16 8:54:21:657 EDT] 00000080 ResourceInjec E CWOWB0102E: A JCDI error has occurred: The ds.services.helper.AbstractServiceHelper/em reference of type javax.persistence.EntityManager for the null component in the Customer_WAR.war module of the DS_APP_EAR application cannot be resolved.
When I copy the persistence.xml file from my jar file to the local WAR's META-INF, this error goes away and everything works fine. Since I have a ton of services to deploy this way, I don't want to have to make copies of persistence.xml for every WAR file.
Is there any way to get WebSphere to find my persistence.xml file? Maybe some setting in WebSphere that I haven't been able to find?
Thanks.
Ok, so it seems that this is a duplicate of the following: Sharing a persistence unit across components in a .ear file
Looking at the answer to that question from Pascal Thivent, it becomes fairly obvious what the problem is: In order to get this to work, the jar file that contains the persistence.xml must be present in the /lib directory of the EAR that is being deployed to WebSphere. Apparently, the way it works is that the EAR resolves the persistence.xml file, and when each WAR file attempts to inject the entity manager, it refers to the EAR to do so. This is in contrast to TomEE (which is deploying without an EAR file). In that case the dependency is resolved by the WAR file classloader, so just having the jar file in the classpath of the WAR is sufficient.

How to change logging level with Mule studio Eclipse plugin

Mule studio loads the log4j properties file from ...eclipse\plugins\org.mule.tooling.server.3.3.1_1.3.2.201212121943\mule\tooling\tooling-support-3.3.1.jar instead of the one provided in the project root folder.
The log4j.properties should be located in src/main/resources, and not in the root folder. You can use the log4j.properties file from the jar as a template and change the logging level with log4j.rootCategory=DESIREDLEVEL, console:
# Default log level
log4j.rootCategory=INFO, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %d [%t] %c: %m%n
################################################
# You can set custom log levels per-package here
################################################
# Apache Commons tend to make a lot of noise which can clutter the log.
log4j.logger.org.apache=WARN
# Shuts up some innocuous messages if using the JBPM transport
log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=ERROR
# Reduce startup noise
log4j.logger.org.springframework.beans.factory=WARN
# Mule classes
log4j.logger.org.mule=INFO
# Your custom classes
log4j.logger.com.mycompany=DEBUG
I found an article that helped me resolve this problem in Mule ESB 3.6. This Mulesoft version uses log4j2 and looks for config as below:
When an application is deployed, Mule will look for a config following
a child first pattern like this:
Look for a file called log4j2-test.xml in the application classpath
Look for a file called log4j2.xml in the application classpath
Look for a file called log4j2-test.xml in the domain classpath
Look for a file called log4j2.xml in the domain classpath
Look for a file called log4j2-test.xml in MULE_HOME/conf
Look for a file called log4j2.xml in MULE_HOME/conf
Apply default configuration.
Just put logj2.xml on classpath ie in src/main/resources. It works.
Link to the article:
http://blogs.mulesoft.org/mule-3-6-asynchronous-logging/