Websocket Log

From Servoy 8.3.3 on 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.

To enable this in 8.3.3 add this to your servoy.properties (in the log area).

log4j.logger.com.servoy.j2db.server.ngclient.MessageLogger=DEBUG, sablomessages
log4j.additivity.com.servoy.j2db.server.ngclient.MessageLogger=false
 
log4j.appender.sablomessages=org.apache.log4j.DailyRollingFileAppender
log4j.appender.sablomessages.datePattern='-'dd'.log'
log4j.appender.sablomessages.File=%%servoy_app_server_dir%%
sablo_message_log.txt
log4j.appender.sablomessages.layout=org.apache.log4j.PatternLayout
log4j.appender.sablomessages.layout.ConversionPattern=%d|%m\n

For 8.4 we have a separate xml file now, to enable it there first add the This in the <Appenders> section:

<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

<Async name="asyncfile">

then add a Logger in the <Loggers> section:

<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)

Last updated