---
title: os_log_create
framework: kernel
role: symbol
role_heading: Function
path: kernel/1643798-os_log_create
---

# os_log_create

Creates a custom log object, to be passed to logging functions for sending messages to the logging system.

## Declaration

```occ
os_log_t os_log_create(const char *subsystem, const char *category);
```

## Parameters

- `subsystem`: An identifier string, in reverse DNS notation, representing the subsystem that’s performing logging. For example, com.your_company.your_subsystem_name. The subsystem is used for categorization and filtering of related log messages, as well as for grouping related logging settings.
- `category`: A category within the specified subsystem. The category is used for categorization and filtering of related log messages, as well as for grouping related logging settings within the subsystem’s settings. A category’s logging settings override those of the parent subsystem.

## Return Value

Return Value A value of type os_log_t, which can be passed to other logging functions to perform logging and to determine whether a specific level of logging is enabled. A value is always returned and should be released when no longer needed.

## Discussion

Discussion Generally, use the OS_LOG_DEFAULT constant to perform logging using the system’s behavior. Create a custom log object only when you want to tag messages with a specific subsystem and category for the purpose of filtering, or to customize the logging behavior of your subsystem with a profile for debugging purposes. This function only needs to be called once to initialize a custom log object. It doesn’t need to be called again when changing logging settings. The system automatically detects changes to logging settings.

## See Also

### Logging

- [OS_os_log](kernel/os_os_log.md)
- [IOLog](kernel/1575337-iolog.md)
- [IOLogv](kernel/1575323-iologv.md)
- [os_log_debug_enabled](kernel/1643808-os_log_debug_enabled.md)
- [os_log_info_enabled](kernel/1643817-os_log_info_enabled.md)

### Related Documentation

- [OS_LOG_TYPE_DEFAULT](kernel/os_log_type_t/os_log_type_default.md)
- [pseudosymbol-1841412](pseudosymbol-1841412.md)
- [pseudosymbol-1841415](pseudosymbol-1841415.md)
- [pseudosymbol-1841417](pseudosymbol-1841417.md)
- [isEnabled(type:)](os/oslog/isenabled(type:).md)
- [pseudosymbol-1841413](pseudosymbol-1841413.md)
- [pseudosymbol-1841414](pseudosymbol-1841414.md)
- [pseudosymbol-1841416](pseudosymbol-1841416.md)
