log4j logger statements are not displayed in jboss wildfly AS - maven

I have added log4j.properties and included relevant log 4j entries in pom.xml in spring mvc web application. But , the logger statements are displayed neither in the eclipse ( which is configured with jboss wildfly AS ) console or server log.

Just removed the log4j.properties file from the web application & surprisingly see JBoss WildFly AS takes care of printing the logger statements in the eclipse console as well as server log.

Related

log4j2 behaviour different between tomcat 8.5.83 and 8.5.39

We have our web app running on tomcat 8.5.39. This app is using log4j2 correctly, applying a system property before log4j2 starts to indicate the log4j.xml configuration file. Something like:
System.setProperty("log4j.configurationFile", "/opt/ventusproxy/logs");
Now we have migrated to tomcat 8.5.83, and after this our webapp is not able to find the configuration file. Asking the log4j team, and after checking log4j debug file, it seems that, for any reason, log4j2 is starting before we set the previous system property.
We also tried 8.5.79 with the same result.
Is there any configuration change that we are missing between 8.5.39 and a later tomcat version that breaks the way log4j2 was working into our webapp until now?
Thanks,
Joan.

Application specific logs not getting generated in JBoss EAP 7.3.0

I have developed an application using Spring Boot and deployed that in JBoss EAP 7.3.0server. The application is writing the application specific logs in a separate log file (not server.log of JBoss) and we are using log4j for logging. The name and path where the lo would be generated is specified in log4j.properties placed in the classpath of the application. This setup is working correctly and logs are getting generated in one of our environments but logs are not getting generated in another environment. We are suspecting that the logger is not defined in JBoss in the environment where the logs are not getting generated. Can anyone please say from where to check the logger configuration of JBoss and how to ensure whether all the configurations are correct so that the logs will get generated?
Note: The JBoss server.log is getting generated correctly in all the environments.

Ehcache 3 logging with log4j in JBoss EAP 7 not working

We have below configuration,
1. Multi module web app based on JSF/Primefaces and Spring 4.2 (separate maven modules for WAR, service JAR etc.)
2. Using Log4j2 as application logging framework
3. Using Ehcache 3 with Spring Cache Abstraction annotations
4. Configured Pom.xml of service module JAR file for Ehcache 3 and java cache-api dependencies
5. Created Ehcache.xml in service module JAR
6. Configured Pom.xml of service WAR with Log4j core and slf4j-log4j12 binding dependencies
7. Configured log4j.xml with for “org.ehcache”
Versions,
JDK 1.8
Spring 4.2
Ehcache 3.3.1
Log4j 1.2
Slf4j-log4j 1.7.7
Problem we are facing,
With all this configuration in place, when we do “run on server” to WAR file on JBoss EAP 7 configured in Eclipse Neon we can’t see Ehcache related log statements in our log file. We can see our application logs though. We tried with various logging levels starting from ALL,TRACE, DEBUG but no logs in log file. Any pointers will really be helpful, we are trying to get this resolved since last 2 days but no luck.
I believe you have a mismatch in your slf4j bindings. You indicate that you are using Log4j version 2 but have placed slf4j-log4j12on the classpath. However that's the binding for log4j version 1.2.
I believe you need instead the binding for log4j 2.

Spring Boot - logging configuration from JBoss

I'd like to know if there is a way to configure Spring Boot logging using JBoss standalone.xml or domain.xml configuration. For now I ended up with two empty files log4j.properties and log4j-file.properties under org\springframework\boot\logging\log4j package in mvn resources in WAR file and it looks like now my logging configuration in domain.xml works because I've overriden default spring-boot log4j configuration.
But there must be a better way to do this instead of this stupid hack. Keep in mind that I don't want to provide external log4j properties file and set it for one of the property in application.properties but I want to use jboss logging system configuration.
EDIT
Strange thing but when I updated Spring Boot to version 1.4.0 then JBoss intercepts the logs and log them only to the file and I don't have logs on the stdout anymore even without custom log4j configuration.

spring restful web service logging

I implemented Spring RESTful Web Service using this tutorial: https://spring.io/guides/gs/rest-service/. I added dependencies for log4j in pom.xml and log4j.properties file in src/main/resources folder. Now I expect logging to be done into log file as stated inthe log4j.properties file instead of to STDOUT. However, logging goes only to STDOUT. How can I fix tis to print log messages to log file?
By default Spring Boot uses LogBack as logging framework.
If you want to configure Log4J, follow this configuration.
You need to exclude Spring Boot's logging module (containing LogBack dependency) and include Spring boot started for log4j.
BTW, log4j is ancient technology, consider moving to logback or log4j2

Resources