Friday, September 7, 2018

how to disable log in spring data neo4j

Leave a Comment

I am getting unwanted query log from spring neo4j like following

25-08-2018 23:47:07.597 [restartedMain] INFO  o.n.o.d.bolt.request.BoltRequest.executeRequest -  Request: MATCH (n:`OntoCategory`) WHERE n.`name` = { `name_0` } WITH n RETURN n,[ [ (n)-[r_h1:`HasSynonym`]->(o1:`OntoSynonyms`) | [ r_h1, o1 ] ] ], ID(n) with params {name_0=Breakfast Items} 25-08-2018 23:47:07.610 [restartedMain] INFO  o.n.o.d.bolt.request.BoltRequest.executeRequest - 

I am using following logging properties in my application.properties

Is there anything I've missed to add. I'm using spring boot version 2.0.3

logging.level.root=info logging.path=path logging.file=${logging.path}/log.log logging.pattern.file=%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n logging.pattern.console=%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %n%highlight%msg%n 

Following two log properties are added from following post which doesn't change anything

log4j.category.org.springframework.data.neo4j=DEBUG log4j.category.org.springframework.data.neo4j.support.query=DEBUG` 

3 Answers

Answers 1

Since you have this configuration :

logging.level.root=info 

The root log level will be info, but if another level is different, it will override it for this log.

So, to have the following behaviour :

  • Neo4j log will be displayed if its level is WARN or higher (so, no request log)
  • Every other log in your app will be displayed if its level is INFO or higher

What you want is to do this :

logging.level.root=info log4j.category.org.springframework.data.neo4j=WARN log4j.category.org.springframework.data.neo4j.support.query=WARN 

Answers 2

If you set the log4j log level to DEBUG, then all log messages at DEBUG level and above (which includes INFO) will be logged.

To prevent INFO level messages from being logged, you should set the log level to WARN (or an even higher level).

Answers 3

log4j.category.org.springframework.data.neo4j.support.query=DEBUG

This entry in the log configuration, logs the query. To avoid logging query to the log files remove this entry.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment