Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable log in spring data neo4j

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`
like image 926
Bibek Shakya Avatar asked Aug 25 '18 18:08

Bibek Shakya


4 Answers

The logging of the cypher query is done by BoltRequest class in neo4j-ogm. So that's where you should be changing the logging level like the following (to keep other logging configuration unaffected):

logging.level.org.neo4j.ogm.drivers.bolt.request.BoltRequest=WARN

Note, however that, as the logging level in this class has been changed very recently according to your request (per #530, by commit f37a78e - logging level of cypher queries downgraded to DEBUG), if you upgrade your SDN installation in your project, you may just be automatically getting rid of the query logs w/o making this adjustment to logging configuration

(I currently have neo4g-ogm-bolt-driver-3.1.4.jar in my project, and I don't get the queries logged).

like image 83
OzgurH Avatar answered Oct 17 '22 10:10

OzgurH


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.

like image 39
pradz_stack Avatar answered Oct 17 '22 09:10

pradz_stack


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
like image 2
LP154 Avatar answered Oct 17 '22 10:10

LP154


By adding this line in application.properties queries is not logging in console.Its working

logging.level.org.neo4j.ogm.drivers=OFF
like image 2
nithin Avatar answered Oct 17 '22 11:10

nithin