简体   繁体   中英

ArangoDB FOXX logging: how to

Is there a way to create my log file on the filesystem where to log some actions in FOXX applications? Any javascript module is required?

There are two ways to log in Foxx:

  1. Using the console module: require('console').log(message)
  2. Using the Foxx console variable: console.log(message)

The Foxx console was introduced in 2.5 and logs to the database in a collection called _foxxlog . As of 2.8 it additionally logs to the same log file as the console module and either behaviour can be disabled.

There is no built-in way to log to other places than the ArangoDB log file and logging to the filesystem directly from Foxx apps is probably not a good idea as Foxx apps can simultaneously run in multiple threads.

If you're using the Foxx console, you can query the current app's log entries via the console.logs object. You can also manually browse the log entries of all Foxx apps by opening the web interface, enabling system collections in the collection administration and opening the _foxxlog collection. Note that the collection is created the first time the log is actually used, so it may not exist if you haven't used the Foxx console yet.

You can find out more about the Foxx console in the documentation (also check the development version if the main documentation hasn't been updated yet).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM