|
[
Permlink
| « Hide
]
Ron Grabowski added a comment - 25/Jul/06 11:05 PM
I don't understand what the problem is or your solution to it. Multi-threaded applications usually don't make guarantee as to the order that worker threads are processed.
I find myself again and again need to explain to others why a message with later time is located in the log file before a message with earlier time.
So I solved the problem by taking the Now instead of loggingEvent.TimeStamp after the synchronization phase on DatePatternConverter You solved your problem...do you still think this is an issue for log4net in general? I don't understand how log4net is suppose to synchronize messages so they get written in the correct time order. What if I'm trying to test out a new threading algorithm and I want messages to be written in the order in which they were processed by the application or something I don't have control over (i.e. the operating system)?
The LoggingEvent captures the event TimeStamp as close as possible to when the event occurred, not when it is written to a log file (which is the job of an appender).
If you want your log file to contain the time the log event is written to the file, rather than the time the event occurs, then you can use the following layout in your appender configuration: <layout type="log4net.Layout.PatternLayout"> <converter> <name value="datenow" /> <type value="log4net.Util.PatternStringConverters.DatePatternConverter,log4net" /> </converter> <conversionPattern value="%datenow [%thread] %-5level %logger - %message%newline" /> </layout> Closing this issue as invalid because it is a usage requirement that can be resolved by correct configuration of log4net. No further action required.
Nicko Cadell made changes - 28/Jul/06 10:36 PM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||