Starts in:
3 DAYS
12 HRS
31 MIN
33 SEC
Starts in:
3 D
12 H
31 M
33 S

ASP.NET Core MVC / Razor Pages UI: JavaScript Logging API

abp.log API is used to write simple logs in the client side.

The logs are written to console, using the console.log, by default.

This document is for simple client side logging. See the Logging document for server side logging system.

Basic Usage

Use one of the abp.log.xxx(...) methods based on the severity of your log message.

abp.log.debug("Some debug log here..."); //Logging a simple debug message
abp.log.info({ name: "john", age: 42 }); //Logging an object as an information log
abp.log.warn("A warning message"); //Logging a warning message
abp.log.error('An error happens...'); //Error message
abp.log.fatal('Network connection has gone away!'); //Fatal error

Log Levels

There are 5 levels for a log message:

  • DEBUG = 1
  • INFO = 2
  • WARN = 3
  • ERROR = 4
  • FATAL = 5

These are defined in the abp.log.levels object (like abp.log.levels.WARN).

Changing the Current Log Level

You can control the log level as shown below:

abp.log.level = abp.log.levels.WARN;

Default log level is DEBUG.

Logging with Specifying the Level

Instead of calling abp.log.info(...) function, you can use the abp.log.log by specifying the log level as a parameter:

abp.log.log("log message...", abp.log.levels.INFO);

Contributors


Last updated: July 31, 2024 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

In this document
Community Talks

What’s New with .NET 9 & ABP 9?

21 Nov, 17:00
Online
Register Now
Mastering ABP Framework Book
Mastering ABP Framework

This book will help you gain a complete understanding of the framework and modern web application development techniques.

Learn More