[prev in list] [next in list] [prev in thread] [next in thread]
List: log4net-user
Subject: Re: Help me with dinamically setting up the RollingFileAppender please
From: "Pavel Bazanov" <pavel () bazanov ! net>
Date: 2008-10-28 15:41:33
Message-ID: BE2114140778440ABD599DCA3CC64D40 () tlt23e29ab816f
[Download RAW message or body]
Thank you for your replies.
Yes, I had to call appender.ActivateOptions() before calling Configure() and \
additionally I had to set appender.Layout. Now it works. Btw, don't you think the \
design is not intuitive enough. How should I know that I have to set Layout and call \
ActivateOptions()? I read quite much on log4net site, but I didn't see good examples \
of using dynamical setting. Don't you think it would be better if ActivateOptions() \
was called automatically in Configure() method and Layout had a default value? What \
we have now is - if you don't know all the details - logging just will not work \
without any helping messages.
----- Original Message -----
From: Ron Grabowski
To: Log4NET User
Sent: Tuesday, October 28, 2008 1:15 AM
Subject: Re: Help me with dinamically setting up the RollingFileAppender please
You probably need to call appender.ActivateOptions() before calling Configure().
------------------------------------------------------------------------------
From: Pavel Bazanov <pavel@bazanov.net>
To: log4net-user@logging.apache.org
Sent: Monday, October 27, 2008 6:16:56 AM
Subject: Help me with dinamically setting up the RollingFileAppender please
Hello,
I have just downloaded the log4net and I can't use the RollingFileAppender. Check \
my code please:
// ###################################################################
var appender = new log4net.Appender.RollingFileAppender();
appender.AppendToFile = true;
appender.File = "log.txt";
appender.MaxFileSize = 10000;
appender.MaxSizeRollBackups = 10;
appender.RollingStyle = log4net.Appender.RollingFileAppender.RollingMode.Size;
log4net.Config.BasicConfigurator.Configure(appender);
log.Info("event occurred");
// ###################################################################
No errors produced, but no log file is created, it just looks like nothing happens.
What am I doing wrong?
Thank you in advance.
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>DIV {
MARGIN: 0px
}
</STYLE>
<META content="MSHTML 6.00.6000.16674" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Thank you for your replies.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Yes, I had to call <FONT face="Times New Roman"
size=3>appender.ActivateOptions() before calling Configure() and additionally I
had to set appender.Layout. Now it works.</FONT></FONT></DIV>
<DIV>Btw, don't you think the design is not intuitive enough. How should I know
that I have to set Layout and call ActivateOptions()? I read quite much on
log4net site, but I didn't see good examples of using dynamical setting.</DIV>
<DIV>Don't you think it would be better if ActivateOptions() was called
automatically in Configure() method and Layout had a default value?</DIV>
<DIV>What we have now is - if you don't know all the details - logging just will
not work without any helping messages.</DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 \
2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message \
----- </DIV> <DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=rongrabowski@yahoo.com href="mailto:rongrabowski@yahoo.com">Ron
Grabowski</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=log4net-user@logging.apache.org
href="mailto:log4net-user@logging.apache.org">Log4NET User</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, October 28, 2008 1:15
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: Help me with dinamically
setting up the RollingFileAppender please</DIV>
<DIV><BR></DIV>
<DIV
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif">
<DIV>You probably need to call appender.ActivateOptions() before calling
Configure().<BR></DIV>
<DIV
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif"><BR>
<DIV
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif"><FONT
face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Pavel Bazanov <<A
href="mailto:pavel@bazanov.net">pavel@bazanov.net</A>><BR><B><SPAN
style="FONT-WEIGHT: bold">To:</SPAN></B> <A
href="mailto:log4net-user@logging.apache.org">log4net-user@logging.apache.org</A><BR><B><SPAN \
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, October 27, 2008 6:16:56
AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Help me with
dinamically setting up the RollingFileAppender please<BR></FONT><BR>
<STYLE></STYLE>
<DIV><FONT face=Arial size=2>
<P><FONT color=#0000ff>Hello, </FONT></P>
<P><FONT color=#0000ff> I have just downloaded the log4net and I can't
use the RollingFileAppender. Check my code please:</FONT></P>
<P><FONT color=#0000ff>//
###################################################################</FONT></P>
<P><FONT color=#0000ff>var</FONT> appender = <FONT color=#0000ff>new</FONT>
log4net.Appender.<FONT color=#2b91af>RollingFileAppender</FONT>();</P>
<P>appender.AppendToFile = <FONT color=#0000ff>true</FONT>;</P>
<P>appender.File = <FONT color=#a31515>"log.txt"</FONT>;</P>
<P>appender.MaxFileSize = 10000;</P>
<P>appender.MaxSizeRollBackups = 10;</P>
<P>appender.RollingStyle = log4net.Appender.<FONT
color=#2b91af>RollingFileAppender</FONT>.<FONT
color=#2b91af>RollingMode</FONT>.Size;</P>
<P>log4net.Config.<FONT
color=#2b91af>BasicConfigurator</FONT>.Configure(appender);</P>
<P>log.Info(<FONT color=#a31515>"event occurred"</FONT>);</P>
<P><FONT color=#0000ff>//
###################################################################</FONT></P>
<P><FONT color=#0000ff>No errors produced, but no log file is created, it just
looks like nothing happens.</FONT></P>
<P><FONT color=#0000ff>What am I doing wrong?</FONT></P>
<P><FONT color=#0000ff>Thank you in advance.</FONT></P></FONT></DIV>
<DIV><FONT face=Arial
size=2></FONT> </DIV></DIV></DIV></DIV></BLOCKQUOTE></BODY></HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic