How to change the Log Level in JakartaEE Maven Projects using neo4j-ogm?

Hi!

We have an issue about the Log Level of the running applications of a JakartaEE 10 project (that does NOT use the Spring framework): using the OGM library (3.2.36 with Bolt Driver), auto-generated queries make reference to Cypher paths that do not already exist, in turn producing WARN logs that saturates the disk (several GBs at day). We would like to set the Log Level to ERROR.

We read the guide but the only reference to the Log Level was: " Neo4j-OGM uses SLF4J to log statements. In production, you can set the log level in a file called logback.xml to be found at the root of the classpath. Please see the Logback manual for further details".

We firstly tried to add the logback.xml to the root classpath but its configurations have been ignored by the Logger (whose class was org.slf4j.impl.Slf4jLogger which is not an implementation of the ch.qos.logback.classic.Logger class).

Then we also tried to explicitly include logback (version 1.4.6) Maven dependency follow the logback guide but without success (we noted that the dependency "ch.qos.logback" was not retrieved by maven neither provided by the JakartaEE 10 certified server, Wildfly 27.0.0.Final, providing the version 2.0.6 of slf4j).

Which is the simplest way to change the Log Level to ERROR?

Best Regards

1 Like

The simplest way would be to define this in the application.properties like this:

quarkus.log.category."org.neo4j.ogm".level=ERROR

SLF4j as a facade will also work with the JBoss logging. No need to add additional libraries.

Hi Gerrit,
thank you for your kind answer but we are not using Quarkus or other frameworks; only the JakartaEE specifications in a Maven project.

We tried to configurate the logging level of the java.util.logging.Logger and also its implementation org.slf4j.impl.Slf4jLogger (offered by the application server) for the BoltRequest and BoltResponse classes but without success. Could you explain what do you mean with "use SLF4j as a facade" with an example (we know the design pattern but we cannot find the method for changing the log level not even after a cast)?

Best Regards

I am so sorry, I completely read Quarkus into this when you were talking about JakartaEE. This is beyond my knowledge about the current state of application servers.
Reading up on this topic I came over GitHub - jboss-logging/slf4j-jboss-logging: SLF4J (1.7.x) Backend for JBoss Logging which mentions that this is already included in WildFly. This would mean that you would only have to configure the category correctly like described here: Logging Configuration - Latest WildFly Documentation , or?

  <logger category="org.neo4j.ogm">
       <level name="WARN"/>
   </logger>