TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Alexandros Pappas
NA
7
5.9k
How to rotate WCF log when maxMessagesToLog is reached?
Jun 13 2019 2:50 AM
I have a WCF service and want to enable logging. As described in Microsoft's documentation [Configuring Message Logging](https://docs.microsoft.com/en-us/dotnet/framework/wcf/diagnostics/configuring-message-logging#feedback), I put in the Web.config the following:
<
system.diagnostics
>
<
sources
>
<
source
name
=
"System.ServiceModel.MessageLogging"
>
<
listeners
>
<
add
name
=
"messages"
type
=
"System.Diagnostics.XmlWriterTraceListener"
initializeData
=
"c:\logs\messages.svclog"
/>
</
listeners
>
</
source
>
</
sources
>
</
system.diagnostics
>
<
system.serviceModel
>
<
diagnostics
>
<
messageLogging
logEntireMessage
=
"true"
logMalformedMessages
=
"false"
logMessagesAtServiceLevel
=
"true"
logMessagesAtTransportLevel
=
"false"
maxMessagesToLog
=
"3000"
maxSizeOfMessageToLog
=
"2000"
/>
</
diagnostics
>
</
system.serviceModel
>
How can I rotate the log, for example write to messages1.svclog, then messages2.svclog, etc. when the number of messages in the last log has reached maxMessagesToLog=3000?
I read the article [A Rolling XmlWriterTraceListener](https://www.codeproject.com/Articles/30956/A-Rolling-XmlWriterTraceListener), but this rotates the log file when a certain file size has been reached. However, when the number of messages reaches maxMessagesToLog, WCF will stop logging.
Reply
Answers (
0
)
wcf need suggestions
WCF timeouts on the server side seem not to do anything