You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by DW...@strohlsystems.com on 2005/03/04 21:38:58 UTC

Re: problem with fileappender

Yes, it does. Here is a sample of the appender that I use daily for my 
development projects:

                <appender name="StandardLog" type=
"log4net.Appender.RollingFileAppender">
                        <AppendToFile value="False" />
                        <!-- Note that any backslashes in the file name 
must be doubled! -->
                        <File value="C:\\DefaultWebSite\\Web.log" />
                        <MaximumFileSize value="1MB" />
                        <RollingStyle value="Composite" />
                        <ImmediateFlush value="True" />
                        <StaticLogFileName value="False" />
                        <layout type="log4net.Layout.PatternLayout">
                                <param name="ConversionPattern" 
value="@%-6p %d %C{1}.%t %m%n" />
                        </layout>
                </appender>

Note however, that your application MUST have write access to the 
file/directory.  If you do not, then you will not create the file.  I say 
this because you have 
it going to the root directory, which in many cases when working in .NET, 
you do not have write (or read) to the root directory.

HTH

David



"Rutledge, J. Mike" <RU...@RJRT.com> 
03/04/2005 02:59 PM
Please respond to
"Log4NET User" <lo...@logging.apache.org>


To
<lo...@logging.apache.org>
cc

Subject
problem with fileappender






I don't understand how you make the fileappender write the log to a 
different name other than log-file.txt. 
My config file contains this: 
<appender name="MyFirstFileAppender" 
type="log4net.Appender.FileAppender"> 
<file value="c:\\zTestfile.txt" /> 
<appendToFile value="true" /> 
<layout type="log4net.Layout.PatternLayout"> 
<conversionPattern value="%5p %d (%c:%L) - %m%n" /> 
</layout> 
</appender> 
Doesn't the file parameter set the location and name of the file? 
Thanks 
Rut 

CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be unlawful. 



IMPORTANT:  E-mails from this company normally contain confidential material for the sole use of the intended recipient.  The use, distribution, transmittal or re-transmittal by an unintended recipient of any communication is prohibited without our express approval in writing or by e-mail.  If you are not the intended recipient please contact the sender and delete all copies.  All e-mails sent to or from Strohl Systems are to be used for our business purposes only.  E-mails sent from or to the company are subject to review by the company.