How to log in Neo4j (respecting original letter case, e.g. uppercase) from Neo4j desktop

82 views Asked by At

I'm using Neo4j desktop, and trying to use APOC to log a message to the info log.

I've read the documentation on this operation here: https://neo4j.com/labs/apoc/4.1/operational/log/

This is the simple code I'm using, which tries to log "hello world" in both upper and lower case:

CALL apoc.log.info('HELLO world')

Then I looked here to see where I'd find the log file: https://neo4j.com/docs/operations-manual/current/configuration/file-locations/

I'm on a Mac, so I've gone to the logs directory:

cd /Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-.../installation-4.0.3/log

and ran tail -f debug.log: log file showing "hello_world" (all lower case)

As you see, the logged message has been converted to lowercase.

In the API docs, I see that there's a property apoc.user.log.type which default to safe (to "replace all . and whitespace (space and tab) with underscore and lowercase all characters"). I believe I need to set the property value to raw, but I'm not sure how.

I've tried these three things with no luck:

CALL apoc.log.info('HeLLo', [type: "raw"])
CALL apoc.log.info('HeLLo', { type: "raw" })
:param "apoc.user.log.type" => "raw"
1

There are 1 answers

0
Peter W On

I found a solution to this.

From the logs/ directory, navigate to the configuration directory for Neo4j:

> cd ../conf
> ls
  jmx.access         jmx.password       neo4j.conf

Then add a APOC config file with the apoc.user.log.type setting from the APOC docs:

> echo "apoc.user.log.type=raw" >> apoc.conf

Then restart the Neo4j database / project.

In other words, the configuration that is documented at the apoc.log.info function level is actually a global configuration that needs to be set for APOC/Neo4j in general in the configuration file. The config file format is specified here: https://neo4j.com/docs/operations-manual/current/configuration/neo4j-conf/