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
Kumar AU
1.1k
309
61.7k
Using Log4Net I need to write only 2 MB Log file
Feb 1 2017 7:23 AM
Dear All,
Kindly let me know in the above code why it’s not writing a log only for 2 MB, (This is my requirement).
My Business Requirement :- Generate a log file every day only one file and keep only 2 MB in size, if the logs are more in size than truncate the old data for the same day.
For My requirement I think below lines of codes are correct, But it’s not working as per my expectation, instead its creating log file which is more in size i.e. 5 MB,6 MB etc..
<appender name="ACLogRollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\Logs\AgentConnect" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value=".yyyy-MM-dd.lo\g" />
<maxSizeRollBackups value="0" />
<maximumFileSize value="2MB" />
<staticLogFileName value="false" />
<filter type="log4net.Filter.DenyAllFilter" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%message%newline" />
</layout>
</appender>
Attachment:
code.zip
Reply
Answers (
2
)
CRUD Operations using NHibernate in asp.net
How to play audio file in Webpage?