silvioprog / brookframework

Microframework which helps to develop web Pascal applications.
https://github.com/risoflora/brookframework
GNU Lesser General Public License v3.0
171 stars 37 forks source link

TEventLog as logger #147

Closed Al-Muhandis closed 6 years ago

Al-Muhandis commented 7 years ago

Is it thread-safe to use TEventLog? TBrookAction run in a separate thread? Do I need to isolate the logging procedure with Synchronize?

silvioprog commented 7 years ago

Hi @Al-Muhandis .

Is it thread-safe to use TEventLog?

Which system do you use? On Linux, it seems TEventLog uses syslog(), that is thread safety by itself.

TBrookAction run in a separate thread?

Do you use CGI or FastCGI? Many HTTP server runs CGI in separated processes in an own thread. However, AFAIK there is no a threaded structure for FastCGI in Free Pascal.

Do I need to isolate the logging procedure with Synchronize?

It seems you don't need it, however it depends on your implementation.

Al-Muhandis commented 7 years ago

Hi @silvioprog Thanks for the quick reply. I use Linux (Debian). Use TEventLog object with file type logging. ÷I am create an object in an initialization of "brokers" file. I give a small bit of code for clarity from "brokers.pas" initialization Logger:=TEventLog.Create(nil); Logger.FileName:=AppDir+'iambot.log'; Logger.LogType:=ltFile; Logger.Active:=True; Logger.Info('Журнал запущен'); I record log during the execution of procedure of TBrookAction GET/POST/etc I use brookframework with FastCGI mode

silvioprog commented 6 years ago

It seems related to the TEventLog component, but please feel free to reopen if you get any problem related to Brook or wants help in TEventLog.