# Websocket Log

You can enable a special logger that will generate then a file with all the messages going to the client and coming from the client.

This will generate a lot of logging so it is not recommended to have this enabled in a production environment (by default).

This can be changed in the log4j.xml file that you deploy, to enable it there first add this in the `<Appenders>` section:

```xml
<RollingFile name="sablomessages"
  fileName="${log4j:configParentLocation}/websocketmessages.txt"
  filePattern="${log4j:configParentLocation}/websocketmessages-%i.txt.zip"
  immediateFlush="true" append="true">
  <Policies>
    <SizeBasedTriggeringPolicy size="10MB" />
  </Policies>
  <PatternLayout pattern="%d|%m%n" />
</RollingFile>
<Async name="asyncsablomessages">
  <AppenderRef ref="sablomessages" />
</Async>
```

Just before the

```xml
<Async name="asyncfile">
```

then add a Logger in the `<Loggers>` section:

```xml
<Logger name="com.servoy.j2db.server.ngclient.MessageLogger" level="DEBUG" additivity="false">
  <AppenderRef ref="asyncsablomessages" />
</Logger>
```

This will generate quite a big file very fast, because it will log all the messages of all the NGClient users.

It does this in the format:

time|sessionid|windowid|clientid|username|R/S|message

R= Receive (from the client)

S= Send (to the client)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/guides/deploy/server-configuration/monitoring/websocket-log.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
