दूसरों log4net का उल्लेख किया है देखते हैं, तो मैं आगे जाना है और दलाल करेंगे Enterprise Library लॉगिंग ब्लॉक है, जो भी की काफी सक्षम है के लिए जो भी आप चाहते हैं
क्या आप कृपया कुछ कोड शामिल कर सकते हैं जो दिखाता है कि यह रोल हर दिन कितना आसान होगा? क्या लॉग 4 नेट उदाहरण से यह आसान है? - डैनियल डायसन
निश्चित रूप से। आमतौर पर, कॉन्फ़िगरेशन बनाने के लिए Enterprise Library Configuration Tool का उपयोग करेगा; यह टूल थोड़ा सा उपयोग करने में आता है, लेकिन एक बार जब आप समझते हैं कि यह कैसे काम करता है, तो यह बहुत शक्तिशाली है। उस ने कहा, आप हाथ से app.config
भी संपादित कर सकते हैं।
यहां बताया गया टूल का आउटपुट यहां दिया गया है, जो हर चीज को रोलिंग फ्लैट फ़ाइल में बहुत अधिक डंप करता है जो हर दिन रोल करता है (या यदि यह 2 एमबी से अधिक हो)। स्वरूपण उपकरण द्वारा प्रदान किया गया डिफ़ॉल्ट है।
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="Category">
<listeners>
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
formatter="Text Formatter" rollInterval="Day" rollSizeKB="2000" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
template="Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Priority: {priority}{newline}
EventId: {eventid}{newline}
Severity: {severity}{newline}
Title:{title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}
Extended Properties: {dictionary({key} - {value}{newline})}"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="Category">
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events">
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</allEvents>
<notProcessed switchValue="All" name="Unprocessed Category">
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</notProcessed>
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
</configuration>
कृपया http://stackoverflow.com/a/8255588/900284 पर एक नज़र यह भी बहुत अच्छा है ले लो। –
यदि आपने एक स्वीकृत उत्तर चुना है तो मैं इसे ऊपर उठाऊंगा। – Joel