TsgcWebSocketServerProperties › LogFile

LogFile Property

Writes every incoming and outgoing socket message to a log file for debugging and auditing.

Syntax

property LogFile: TsgcWSLogFile read GetLogFile write SetLogFile;

Default Value

Enabled=False, UnMaskFrames=True

Remarks

Set LogFile.Enabled to True and LogFile.FileName to the full path of the log file; every message received and sent over the socket is then appended to the file, which is invaluable during development or production troubleshooting. UnMaskFrames (default True) stores the payload unmasked for easier inspection. The file is opened on demand and closed on each write; avoid enabling the log on production servers under heavy load as disk I/O will become a bottleneck.

Example


oServer := TsgcWebSocketServer.Create(nil);
oServer.LogFile.FileName := 'c:\logs\server.log';
oServer.LogFile.Enabled := true;
oServer.Active := true;

Back to Properties