Alternatively, you could specify another error-only appender in your log4net
configuration, like the following:

<appender name="RollingFile_Error"
type="log4net.Appender.RollingFileAppender">
            <threshold value="ERROR"/>
            <file value="log_error.log"/>
            <appendToFile value="true"/>
            <rollingStyle value="Date"/>
            <datePattern value="yyyyMMdd"/>
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline"/>
            </layout>
        </appender>

In code, you would want your stacktrace to be logged as Debug, so you would
need two lines to accomplish what you're talking about:

log.Error(exception.Message);
log.Debug("",exception);


Personally, I think Karim's suggestion is much more elegant.

-Ross

On Mon, Aug 17, 2009 at 4:13 AM, Karim Bourouba <[email protected]> wrote:

>  Have you considered logging to a db, then generating reports from there
> instead?
>
>
>
> Seems to me to be a bit more elegant than logging to two text files.
>
>
>
>
> ------------------------------
> Subject: Can we write the data to Multiple log
> Date: Mon, 17 Aug 2009 13:46:42 +0530
> From: [email protected]
> To: [email protected]
>
>
>  Hi,
>
>
>
> I am using the Rolling File Appender, and in this I would like to write the
> exception raised to two different logs one with simple information and other
> with the complete information.
>
>
>
> In the config file I have two sections defining the paths.
>
>
>
> <?xml version="1.0" standalone="yes" ?>
>
> <DataSetConfiguration xmlns="
> http://www.volkswagen.de/xmldefs/disk/DSLoggingConfiguration.xsd";>
>
>   <SYSTEMINFORMATION>
>
>     <SYSTEMID>DIS</SYSTEMID>
>
>     <ERRORCODELISTPATH>/config/errorCode.xml</ERRORCODELISTPATH>
>
>   </SYSTEMINFORMATION>
>
>
>
>   <APPENDER MODE="tivoli" NAME="RollingLogFileAppender"
> TYPE="log4net.Appender.RollingFileAppender">
>
>     <FILENAME VALUE="d://svr_app_prod//logs//app_logs//diss//tivoli.log" />
>
>     <APPENDTOFILE VALUE="true" />
>
>     <ROLLINGSTYLE VALUE="Size" />
>
>     <MAXROLLBACKUPSIZE VALUE="10" />
>
>     <MAXFILESIZE VALUE="10MB" />
>
>     <MAXENTRIESPERSECOND VALUE="10" />
>
>     <STATICLOGFILENAME VALUE="true" />
>
>     <LAYOUT TYPE="log4net.Layout.PatternLayout">
>
>       <CONVERSIONPATTERN VALUE="%date [%thread] %-5level %logger
> [%property{ndc}] - %message%newline" />
>
>     </LAYOUT>
>
>   </APPENDER>
>
>
>
>   <APPENDER MODE="application" NAME="RollingLogFileAppender"
> TYPE="log4net.Appender.RollingFileAppender">
>
>     <FILENAME
> VALUE="d://svr_app_prod//logs//app_logs//diss//application.log" />
>
>     <APPENDTOFILE VALUE="true" />
>
>     <ROLLINGSTYLE VALUE="Size" />
>
>     <MAXROLLBACKUPSIZE VALUE="50" />
>
>     <MAXFILESIZE VALUE="50MB" />
>
>     <MAXENTRIESPERSECOND VALUE="10" />
>
>     <STATICLOGFILENAME VALUE="true" />
>
>     <LAYOUT TYPE="log4net.Layout.PatternLayout">
>
>       <CONVERSIONPATTERN VALUE="%date [%thread] %-5level %logger
> [%property{ndc}] - %message%newline" />
>
>     </LAYOUT>
>
> </APPENDER>
>
> </DataSetConfiguration>
>
>
>
> In our application we only mention Log.Debug(“Logging Information”).
>
>
>
> Could you please tell me how to specify the details of the log file.
>
>
>
> Regards,
>
> *Raghuram Raichooti*
> *
> ________________________________________________________________________________________________________________
> *
>
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the email by you is prohibited.
>
> ------------------------------
> Windows Live Messenger: Thanks for 10 great years—enjoy free winks and
> emoticons. Get Them Now <http://clk.atdmt.com/UKM/go/157562755/direct/01/>
>

Reply via email to