> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# Log class

> How to use the global log object to output errors, warnings, and information to the console or Itential Platform log files.

The Log class is an Itential Platform class used to output errors, warnings, and other information to the console or the Itential Platform log files.

## Access the log object

Itential Platform instantiates the Log class on startup and exposes it as the global `log` object. Applications and adapters may reference it directly.

### Example cog file

```javascript
/* global adapters */
/* global brokers */
/* global cogs */
/* global log */

function test(callback) {
  log.info("I am a log entry");
}

function debug(callback) {
  log.debug("reconciling:" + device);
}
```

## Log levels

Log levels control the amount of information recorded. Each level has an associated severity. The following levels are available:

| Method    | Description                                                                                                                                                                                                      |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `console` | Deprecated.                                                                                                                                                                                                      |
| `spam`    | Collect or output excessive or repetitive messages, large text files, or large quantities of data such as search results — information that, though relevant, would clutter the log file and render it unusable. |
| `trace`   | Minor events within functions. Like "breadcrumbs" within a function.                                                                                                                                             |
| `debug`   | Major events such as successful data retrieval from an external system or the completion of a function.                                                                                                          |
| `info`    | Successful status change; limited to one message per successful action.                                                                                                                                          |
| `warn`    | Issues or unexpected behavior that does not impact functionality.                                                                                                                                                |
| `error`   | Errors or failures in the code that impact functionality.                                                                                                                                                        |

`console.log` is not supported by Itential Platform. Use the Log class instead.

Log levels are defined in the `loggerProps` object of the Itential Platform **Profile**, configurable within the **Admin Essentials** application.

* The `log_level` property determines the level for the log file.
* The `console_level` property determines the level for the console.
* In the example below, `log_level` is set to `info`, which means any logging at `info` severity or higher will be written to the log file (`info`, `warn`, `error`, `debug`, `console`, `trace`).
* If `log_level` were `debug`, Itential Platform would log all `log.debug` messages from cogs and adapters.

## Properties file

The following is an example of the `loggerProps` object in an Itential Platform **Profile**:

```json
"loggerProps": {
  "description": "Logging",
  "log_max_files": 100,
  "log_max_file_size": 1048576,
  "log_level": "info",
  "log_directory": "/var/log/itential/",
  "log_filename": "itential.log",
  "log_timezone_offset": 0,
  "console_level": "info"
}
```