mperdeck/jsnlog.js

Debug and Trace level is not logging in Console even if the level is set to Trace/Debug/All

manojp1988 opened this issue · 2 comments

In Angular 2 application, I have created two appenders and injected the JL as per the document.

app.module.ts

var ajaxAppender = JL.createAjaxAppender('ajaxAppender');
ajaxAppender.setOptions({
  "batchSize": 6,
  "bufferSize": 40,
})
var consoleAppender = JL.createConsoleAppender('consoleAppender');

JL().setOptions({
  level:1000,
  "appenders": [consoleAppender, ajaxAppender]
});

  providers: [
    { provide: 'JSNLOG', useValue: JL },
     AppService,
  ],

app.component.ts

constructor(@Inject('JSNLOG') JL: JL.JSNLog) {
    this.JL = JL;
}
ngOnInit() {
    this.JL().trace("It is a trace message");
    this.JL().debug("It is a debug message");
    this.JL().info("It is info message");
    this.JL().warn("It is a warn message");
    this.JL().error("It is a error message");
    this.JL().fatal("It is a fatal message");
  }

In the console, only info and above messages are showing. But not trace and debug.
AjaxAppender is showing trace and above as expected.

I guess you're using Chrome.

Chrome allows you to filter log messages to the console. By default, the lowest severity in Chrome, "verbose" is disabled. JSNLog maps trace and debug to "verbose".

To solve this, in the Chrome debugger, in the Console tab, change the dropdown from Info to Verbose. See the attached screenshot.
capture

Thank you. It is showing now after configuring chrome.