简体   繁体   English

ArangoDB FOXX日志记录:如何

[英]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? 有没有办法在文件系统上创建我的日志文件,在FOXX应用程序中记录某些操作? Any javascript module is required? 需要任何javascript模块吗?

There are two ways to log in Foxx: 登录Foxx有两种方法:

  1. Using the console module: require('console').log(message) 使用console模块: require('console').log(message)
  2. Using the Foxx console variable: console.log(message) 使用Foxx console变量: console.log(message)

The Foxx console was introduced in 2.5 and logs to the database in a collection called _foxxlog . Foxx控制台在2.5中引入,并在名为_foxxlog的集合中记录到数据库。 As of 2.8 it additionally logs to the same log file as the console module and either behaviour can be disabled. 从2.8开始,它还会记录与控制台模块相同的日志文件,并且可以禁用任一行为。

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. 没有内置的方式来登录到ArangoDB日志文件以外的其他地方,直接从Foxx应用程序登录到文件系统可能不是一个好主意,因为Foxx应用程序可以同时在多个线程中运行。

If you're using the Foxx console, you can query the current app's log entries via the console.logs object. 如果您使用的是Foxx控制台,则可以通过console.logs对象查询当前应用程序的日志条目。 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. 您还可以通过打开Web界面,在集合管理中启用系统集合并打开_foxxlog集合,手动浏览所有Foxx应用程序的日志条目。 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. 请注意,该集合是在第一次实际使用日志时创建的,因此如果您尚未使用Foxx控制台,它可能不存在。

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). 您可以在文档中找到有关Foxx控制台的更多信息(如果主文档尚未更新,还要检查开发版本 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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