28 Aug 14:41
Use Pattern name in message
From: Pascal ROZE <pascal.roze <at> gmail.com>
Subject: Use Pattern name in message
Newsgroups: gmane.comp.log.log4net.user
Date: 2008-08-28 12:44:44 GMT
Subject: Use Pattern name in message
Newsgroups: gmane.comp.log.log4net.user
Date: 2008-08-28 12:44:44 GMT
Hi all
At this time, I have a logger with the following configuration:
<layout type="log4net.Layout.PatternLayout,log4net">
<conversionPattern value="LEVEL: %level %newlineDATE: %date %newlineLOGGER: %logger %newline%newline%message"/>
</layout>
It works fine.
Now, I would like to use Pattern names in message variable.
For example, I'm trying to do:
string msg = "The time is %date and the logger is %logger";
myLogger.Info(msg);
And of course, it doesn't work.
The output is: The time is %date and the logger is %logger.
Any idea to achieve that?
Thx a lot
Pascal
At this time, I have a logger with the following configuration:
<layout type="log4net.Layout.PatternLayout,log4net">
<conversionPattern value="LEVEL: %level %newlineDATE: %date %newlineLOGGER: %logger %newline%newline%message"/>
</layout>
It works fine.
Now, I would like to use Pattern names in message variable.
For example, I'm trying to do:
string msg = "The time is %date and the logger is %logger";
myLogger.Info(msg);
And of course, it doesn't work.
The output is: The time is %date and the logger is %logger.
Any idea to achieve that?
Thx a lot
Pascal
RSS Feed