0

In the documentation I could find for Log4js, there is a function isTraceEnabled(), which is defined as

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?

Community
  • 1
  • 1
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150

1 Answers1

2

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. For example: logger.isInfoEnabled() will return true if the level for the logger is INFO or lower.

Like the documentation sais, is<level>Enabled() returns true if a log event of that level is enabled.

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. For example:

var logger = log4js.getLogger();
logger.level = 'debug';

In this concrete case isTraceEnabled() will return false. If you use either trace or all it will return true.

Ivan Beldad
  • 2,285
  • 2
  • 21
  • 33