473,698 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

log4net clear log file

Hi there,
I am using log4net in my (.net v1.1) application to log the messages. I
tried to clear the logfile while application is running. since log4net has
the file handle it did not allow me to clear/delete the file. I need to clear
the content of the log file specified in the log4net configuration file, when
it is needed in the application(suc h as some button click event), If anybody
familiar with log4net your help would be appriciated...

--Dhans
Apr 7 '06 #1
4 10584
Hello Dhans,

I don't use log4net for several month, but there was a option of log4net
config's file where you can specify what to do with log - override or append.
Look through doc carefully

D> Hi there,
D> I am using log4net in my (.net v1.1) application to log the messages.
D> I
D> tried to clear the logfile while application is running. since
D> log4net has
D> the file handle it did not allow me to clear/delete the file. I need
D> to clear
D> the content of the log file specified in the log4net configuration
D> file, when
D> it is needed in the application(suc h as some button click event), If
D> anybody
D> familiar with log4net your help would be appriciated...
D> --Dhans
D>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Apr 8 '06 #2
Hi Michael,
Thanks for your response. In my config I have selected append option. It is
not related to config file. I need to clear the content of the log file when
ever i need to do from the application while it is running.

Is there any newsgroup for log4net or where i can get help on that?

--Dhans

"Michael Nemtsev" wrote:
Hello Dhans,

I don't use log4net for several month, but there was a option of log4net
config's file where you can specify what to do with log - override or append.
Look through doc carefully


Apr 9 '06 #3
In article <C1************ *************** *******@microso ft.com>, Dhans
wrote:
I need to clear the content of the log file when
ever i need to do from the application while it is running.


You could try using the RollingFileAppe nder which can switch to a
different file based on date/time or log file size.

That allows you to at least delete older logs.

Mike

Apr 10 '06 #4
Thanks Michael...

"Mike Blake-Knox" wrote:
You could try using the RollingFileAppe nder which can switch to a
different file based on date/time or log file size.

Apr 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
732
by: SK | last post by:
Hi, I am using log4net in my c# application.Want to know how to customize the log output format. I know that it can be done using LayoutSkeleton class,but dont know what other parameters to be given in the log4net config file. Please help
0
1736
by: anonieko | last post by:
Add a reference to log4net.dll 1: In the APP.CONFIG write the following: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="log4net" type="System.Configuration.IgnoreSectionHandler" /> </configSections>
4
2206
by: Gawel | last post by:
hajo, can someone send me an example how to use above pattern in asp.net applicaiton? I can not figure out how to do it. I get no exceptions, simply no logging occures. Thanks for any info Gawel
2
5152
by: Vikram | last post by:
I am using log4net in a vb.net console application. But its not working. I have added congif setting in app.config file also No error is generated but app. does not write to log file. app.config file: <?xml version="1.0" encoding="utf-8" ?>
6
8102
by: Mr Flibble | last post by:
Hi all, I've decided to use log4net for my logging/tracing. In the example on the site it shows using main() to setup the root logger and then using the LogManager within your classes to create more loggers (subloggers). This is nice since I can use just one configuration file to control the behaviour of all the loggers within my app. This is great if I'm using a project that contains all my classes but what happens if my class is in...
2
2095
by: Marc Scheuner | last post by:
Folks, I'd really like to use log4net for our error logging, but I'm having two problems: 1) For certain cases, I'd like to log error and messages to text files. I tried both the regular FileAppender, as well as the RollingFileAppender, but both don't work exactly the way I'd like them to.
1
5175
by: chidam.chidam | last post by:
Hi all, I would like to implement log4net for logging my application. First let me describe in short about the application. I have a solution with two exe file outputs and several dll assemblies. And my application has a different AppDomain as it is a customization of another COM based application written in VB.NET. I have tried with App.Config files in my startup exe applications. It works fine only till the parent application is...
2
20031
by: forest demon | last post by:
I need to be able to create an appender to direct output to a MessageBox. The API does not have a MessageBox appender like nLog does. What would be the easiest way to do this. The examples supplied with the source are anything but helpful. Thanks for any input. -fd
0
1478
by: rosshinkley | last post by:
Greetings. I know that log4net supports filtering based on properties (log4net.Filter.PropertyFilter). Trouble is, I'm having trouble spotting what valid property names are. Are they intrinsic to log4net or are they defined by the appender/logger itself? I would like to filter on a method name, for example, instead of the message itself. PropertyFilter looks promising because MDCFilter and NDCFilter are supposedly deprecated in...
0
8678
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.