I invoke the Neo4j driver from my application to connect to Neo4j. Now I use a logger in my application and write the logs into a certain log file in the application directory. In addition, I now have the requirement that all logs of the driver are also written to either the same file or at least the same directory. Is this basically feasible and is it possible to configure the driver to write to a log file? Logging on the console works for me and I see quite a lot, but how can write the log into a file?

I use this code to call the logger:

Logging logging = Logging.javaUtilLogging(SSEService.loggingLevel);
            Config config = Config.build().withLogging(logging).toConfig();
            driver = driver(singleton.getUrl(), AuthTokens.basic(singleton.getUser(), singleton.getPassword()),config );

These are my console logs, that I want to write into a file.

FEIN: [0x5fc0b804][dockerhost03.tiq.local:7687][] S: RECORD ["Bruno Kirby", "When Harry Met Sally", 1998, 1]
Mai 03, 2019 1:39:04 PM org.neo4j.driver.internal.logging.JULogger trace
AM FEINSTEN: [0x5fc0b804][dockerhost03.tiq.local:7687][] S: 0025b171948e4a616d6573204d61727368616c6c8e412046657720476f6f64204d656ec907c801
Mai 03, 2019 1:39:04 PM org.neo4j.driver.internal.logging.JULogger trace
AM FEINSTEN: [0x5fc0b804][dockerhost03.tiq.local:7687][] S: 0000
Mai 03, 2019 1:39:04 PM org.neo4j.driver.internal.logging.JULogger trace
AM FEINSTEN: [0x5fc0b804][dockerhost03.tiq.local:7687][] S: b171948e4a616d6573204d61727368616c6c8e412046657720476f6f64204d656ec907c801

0 Answers