Here's my app.config (the date pattern is different, but you can change that). Note, there were various glitches with this in earlier versions of log4net; if your files end up getting logged to ..../2005-07-22/A/Ax instead of being named as you expect, you should upgrade.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
    <log4net>
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
            <file value="//tank/logs$/seo/log-" />
            <appendToFile value="true" />
            <datePattern value="yyyy-MM-dd'.txt'" />
            <rollingStyle value="Date" />
            <staticLogFileName value="false" />
            <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %c line %L%n %m%n" />
            </layout>
        </appender>
        <root>
            <appender-ref ref="FileAppender" />
        </root>
    </log4net>
</configuration>

Ronnie Hayden wrote:
does anyone know how I can log messages into a file
with the following filename format:
mylog_yyyyddmm.log
where "mylog_" and ".log" are constant and yyyymmdd is
the current date, and a new file is created for each
day.

i know the RollingFileAppender can almost achieve this
where i can create a log file with the date appended
to the name but i'm not able to specify an extension.

if anyone knows how to do this please get back to me.

thanks,

ron.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Reply via email to