#1 Re: mORMot 1 » How to use SynLog like log4PHP or log4J? » 2017-03-24 14:43:20

We are not using the framework, only the TSynLog - class itselfs. Maybe later we will switch to the framework.

Our use case (by customer security and application requirements) is that different log entries identified by levels have to be written into separate log-files.
The only approach so far i got working as expected is the following:

type
  TXLog = class(TSynLog);
  TYLog = class(TSynLog);
var
  XLog: TSynLogClass = TXLog;
  YLog: TSynLogClass = TYLog;
...

  TXLog.Family.Level          := LOG_VERBOSE;
  TXLog.Family.CustomFileName := 'XLog';

  TYLog.Family.Level          := [sllUserAuth];
  TYLog.Family.CustomFileName := 'YLog';

  TXLog.Add.Log(sllInfo, 'Starting x');
  TXLog.Add.Log(sllSQL, 'SQL');

  TYLog.Add.Log(sllInfo, 'Starting y'); // Will not be written
  TYLog.Add.Log(sllUserAuth, 'User Auth');

#2 mORMot 1 » How to use SynLog like log4PHP or log4J? » 2017-03-23 20:32:58

AlexZ
Replies: 3

Hi,
is it possible to use SynLog like log4PHP / log4J? (Database Appender, Mail Appender) Or is TSynLog's use case only for text-file logging?

The only customizing option is EchoCustom, is there an example how to integrate a log4D implementation?

Regards
Alex

Board footer

Powered by FluxBB