Since my current assignment is to evaluate logging systems for use in Delphi XE 3, I'm trying to get to know Opensource solutions as well as CodeSite and SmartInspect. Currently I'm trying to get to know Log4Delphi but beside the little amount of documentation I encountered the following problem using Log4Delphi in Delphi XE3:
The basic logging functionality works quite fine. But I encountered a problem when I was trying to use the layout options to add further information like timestamps to my logging messages.
I use the following statement for loading my configuration file within the dpr-file:
TConfiguratorUnit.doPropertiesConfiguration(ExtractFileDir(Application.ExeName)+ '\MyLoggerconfig.properties');
At first I suspected there was a problem with the config files' path, so I wrote a different method which used the GetCurrentDir method. But I soon realised the config file is working.
No matter what kind of layout I choose in the config file, the appender keeps writing the log messages without using the proper formating. I tried to do exactly how the USer Guide of Log4Delphi told me. But currently I can'f figure out why it doesn't work properly.
var
Form5: TForm5;
logger: TLogger;
layout : TLayout;
implementation
In order to use my logger I declared it as seen above.
logger := TLogger.GetInstance;
logger.SetLevel(TLevelUnit.ALL);
I use these two methods to initiliaze my logger in the mainforms oncreate event.
log4delphi.appender.fileAppender.layout=TPatternLayout
log4delphi.appender.fileAppender.layout.Pattern=%d{dd mmm yyyy hh:nn:ss:zzz} [%5p] %m%n
As you can see above I have chosen the default for the TPatternLayout and the log messages should contain various informations like timestamps. But instead the look like this:
WARN - Value of zahl1 2
WARN - Value of zahl2 4