Spring Boot App no longer logging to eclipse(STS) console - java

I've just combined several rest service projects into a a gradle multi-project. In order to do this I created a new workspace and imported everything after configuring my build.gradle for each project.
Most of the applications were able to start correctly using run as spring boot application however now in this new workspace nothing is being logged to the console. I was able to see the logs before in my old workspace.
I am using compile('org.projectlombok:lombok:1.16.6') in my parent build.gradle with the #Slf4j annotation which generates a logger field to write to the log in my classes.
Everything seemed to just work before and now I'm not sure what happened that is preventing logging.
Any help is appreciated
-Thanks

Related

Invalid logger interface org.hibernate.internal.EntityManagerMessageLogger

I am doing JPA without persistence.xml (without Spring Boot) and instead used the PersistenceUnitInfo to create the entity manager. When running the application from my IDE, there are no errors, but it logs sensitive persistence unit information. I've struggled to disable the logging.
It gets worse, when I run it from the command line, I get the following:
Kindly assist, I've lost quite a few hours to this one.
The issue you encounter is a classloading issue during initialization of your EntityManager on your JBoss application environement.
Disabling the logging will not fix this error, but hide it. Check your deployment classpath, and your JDK version. And verify that all required hibernate libraries are present. You can check which libraries you need on the classpath by looking at the dependencies on a site such as mvnRepository (example: https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core/6.0.2.Final).
Are you using a dependency manager, such as Maven or Gradle?

Quarkus logging conflict between log4j-core and jboss log manager

I am having an issue with logging information for some of the microservices running on Quarkus. Some of the projects have the below settings in the build.gradle:
implementation 'org.apache.logging.log4j:log4j-core'
runtimeOnly 'org.jboss.logmanager:log4j2-jboss-logmanager'
Our code uses apache log4j LogManager and Logger to log information. When we have the projects with these 2 dependencies in the gradle file, the log settings don't work and as a result, nothing gets written (except for the default setting of error) irrespective of any settings in the application.properties. For the other projects where there is no dependency on log4j-core, the logging works perfectly fine.
What i was told by one of my colleagues is that there is some overriding happens when these 2 libraries are included in a project and he suggested using the org.jboss.logging.Logger in place of the apache log4j LogManager. I haven't tried any other settings but i do see the info logs now in the log file so it is working though i am having to change some code to match the method signatures on the jboss Logger object. While i am happy it's working, i would like to avoid having to code logic in 2 different ways across projects (example - Logger comes from LogManager in apache log4j whereas it just comes from Logger class itself in jboss approach)
I am trying to understand what is causing this conflict and why and also if anyone has any better way than what I did to make it work. Please let me know
Thanks in advance for your help!
Best Regards
SG

Springboot hangs after removing logback-classic dependency

I am working with a SpringBoot project. Initially, when I am running the application I was getting the "multiple bindings" warning and no log files were getting created but the application started taking the log-back classic dependency and ignoring the slf4j-log4j12 artifact (Both are child dependencies of spring-boot-starter-logging which is in turn a child of spring-boot-starter). However, once I excluded the logback-classic artifact it has started to hang at the line INFO: Initializing Spring embedded WebApplicationContext and no log files are being generated. In this project I see that log4j is being used and the web.xml has been entirely commented out. Is the hanging of the application at startup related to any of the above actions or conditions?
Thanks in advance for the help. Please note that I am new to SpringBoot and nothing seems to work in this framework as mentioned in the docs so I am a bit frustrated as well. Any help will be really appreciated.

Avoid getting slf4j from maven

Maven uses slf4j, so as soon as it is launched, it initializes it with its default implementation contained into apache-maven-3.3.9\lib\slf4j-simple-1.7.5.jar and with configuration file defined in apache-maven-3.3.9\conf\logging\simplelogger.properties.
After that it loads the pom file and found my jetty-maven-plugin which launch a webapp. But in this webapp I want to use a different implementation for slf4j, but I can't because slf4j is already initialized.
I understand that maven is mainly a tool for build and not to launch apps, but I can't modify log configuration of apache-maven for each project to get pretty logs for each of them.
Is someone already face this issue and find a way to avoid that?
Note:
run-forked instead run works but in this case I can't no more debug from eclipse so I prefer an another solution.
older version of maven works as 3.0.3 because it didn't used slf4j

Running Multiple Spring Projects with different Spring Versions on Eclipse

Configuration problem: You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd schema with Spring Security 3.1. Please update your schema declarations to the 3.1 schema.
Offending resource: class path resource [authentication-context.xml]
In my Eclipse workspace are a set of Mavenised Spring projects on Spring verion 3.0.6..
It's a fairly large, complicated application, about a year old, with a parent pom and 6/7 sub-poms for different components. I'll title it Project A for now.
Project A has two webapps within it, a public based website and a backoffice administration area.
Recently a seperate application was built for Project A to interact with via REST calls.
However this new application, Project B runs on Spring 3.1.1. This is in the same Eclipse workspace.
Project A's customer website and Project B ran fine on the same tomcat, there were no confused dependencies.
But now that development has started on Project A's backoffice interacting with Project B, there is a conflict, in the Spring security versions when Tomcat is launched.
Current solutions we've attempted have failed, but we haven't tried updating the
Spring version in Project A (fairly sure things will break and not sure it's worth the time retesting) and
downgrading Spring in Project B seems like a horrible precedent to set.
Anyone have any experience with this?
Any help is appreciated :-)

Categories