> For the complete documentation index, see [llms.txt](https://totalsoft.gitbook.io/graphql-rocket-generator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://totalsoft.gitbook.io/graphql-rocket-generator/built-in-architecture/logging.md).

# Logging

This features uses [@totalsoft/apollo-logger](https://github.com/osstotalsoft/rocket-toolkit/tree/main/packages/apollo-logger#apollo-logger) which comes with an Apollo logging plugin, that helps you monitor the execution of your GraphQL operations with the use of the request life-cycle events.

{% hint style="info" %}
Read more about Apollo Server plugins here: [Plugins](https://www.apollographql.com/docs/apollo-server/integrations/plugins/)
{% endhint %}

{% hint style="info" %}
If desired, the logs can be persisted in a database, file or somewhere else, see [documentation](https://github.com/osstotalsoft/rocket-toolkit/tree/main/packages/apollo-logger#--apollologgingoptions) for more details.
{% endhint %}

This generator wishes to provide an example of `saveLogs` implementation that can be found in `utils/logging.js` file.

The provided helper function for logging persistence, requires the following `__Logs` table to be created in your database.

```sql
CREATE TABLE [dbo].[__Logs](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Message] [nvarchar](max) NULL,
	[Level] [nvarchar](max) NULL,
	[TimeStamp] [datetime] NULL,
	[Exception] [nvarchar](max) NULL,
	[LogEvent] [nvarchar](max) NULL,
	[ServiceName] [varchar](200) NULL,
	[TenantId] [uniqueidentifier] NULL,
	[CorrelationId] [uniqueidentifier] NULL,
 CONSTRAINT [PK___Logs] PRIMARY KEY CLUSTERED ([Id] ASC)
)
```

In addition, the errors thrown inside Apollo Server, can be wrapped in a 'user friendly message'. This increases the security of your application by making sure there are no sensitive data leaks. To activate this feature, use the `securedMessages: true` option when instantiating the plugin:

```javascript
new ApolloLoggerPlugin({ securedMessages: false })
```
