[英]In Log4js how do you enable tracing?
In the documentation I could find for Log4js, there is a function isTraceEnabled()
, which is defined as 在我可以找到的Log4js文档中,有一个函数
isTraceEnabled()
,其定义为
isTraceEnabled
isTraceEnabled
checks if Level Trace is enabled
检查是否启用了“级别跟踪”
However, I can't find anywhere how do you actually enable (not check) this trace level. 但是,我找不到任何地方可以实际启用(而不检查)此跟踪级别。 How can you do this?
你该怎么做?
is<level>Enabled()
- returns true if a log event of level (camel case) would be dispatched to the appender defined for the logger's category.is<level>Enabled()
-如果将级别(日志大小写)的日志事件调度到为记录器的类别定义的附加程序,则返回true。 For example:logger.isInfoEnabled()
will return true if the level for the logger is INFO or lower.例如:如果记录器的级别为INFO或更低,则
logger.isInfoEnabled()
将返回true。
Like the documentation sais, is<level>Enabled()
returns true if a log event of that level is enabled. 就像文档sais一样,如果启用了该级别的日志事件,
is<level>Enabled()
返回true。
There are all this levels: 所有这些级别:
ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF
全部<跟踪<调试<信息<警告<错误<致命<标记<关闭
Left ones includes the others on the right side. 左边的包括右边的其他。
To set the level of the logger set the level
property to the desired one. 要设置记录器的级别,请将
level
属性设置为所需的level
。 For example: 例如:
var logger = log4js.getLogger();
logger.level = 'debug';
In this concrete case isTraceEnabled()
will return false
. 在这种具体情况下,
isTraceEnabled()
将返回false
。 If you use either trace
or all
it will return true
. 如果使用
trace
或all
,它将返回true
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.