logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <raghuram.raicho...@accenture.com>
Subject RE: Can we write the data to Multiple log
Date Tue, 18 Aug 2009 06:43:53 GMT
Hi,

 

>From the UI how can I specify the details to which appender to use.

 

My requirement is like there will be two log:

-          Complete Information, which contains data along with the stack trace and many more
parameters coming from the exception

-          Simple information saying “There was a error with code and simple details”

 

And in this case I need to log them in two different logs at a time.

 

Can you please  send me the samples. 

 

Thanks in advance.

 

Regards,

Raghuram Raichooti 
________________________________________________________________________________________________________________

 

From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Tuesday, August 18, 2009 7:06 AM
To: Log4NET User
Subject: Re: Can we write the data to Multiple log

 

Does this example help?

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <appender name="SimpleLayoutFileAppender" type="log4net.Appender.FileAppender">
    <file value="Logs\Simple.txt" />
    <layout type="log4net.Layout.SimpleLayout" />
  </appender>
  <appender name="PatternLayoutFileAppender" type="log4net.Appender.FileAppender">
    <file value="Logs\PatternLayout.txt" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%5level %date (%logger:%line) - %message%newline" />
    </layout>
  </appender>
  <root>
    <appender-ref ref="SimpleLayoutFileAppender" />
    <appender-ref ref="PatternLayoutFileAppender" />
  </root>
</log4net>

 

________________________________

From: "raghuram.raichooti@accenture.com" <raghuram.raichooti@accenture.com>
To: log4net-user@logging.apache.org
Sent: Monday, August 17, 2009 4:16:42 AM
Subject: Can we write the data to Multiple log




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" ?>

  <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.



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.

Mime
View raw message