Put Debug Info and Error Info into two different log file (Log4net) -


I am using NHibernate and log4net This is a snapshot of my error log file, using the release version of my software :

  iNFO 2009-04-28 03:07:06 - processing Cosked NHibernate.Engine.CascadingAction + action to SaveUpdateCascadingAction: bpojob.Generated.BusinessObjects.Job information 2009-04-28 03 : 07: 06 - cascade NHibernate.Engine.CascadingAction + SaveUpdateCascadingAction collection: bpojob.Generated.BusinessObjects.Job.JobItems DEBUG2009-04-28 03:07:06 - saveOrUpdate wide: bpojob.Generated.BusinessObjects.JobItem DEBUG2009- 04-28 03:07:06 - Not saved-value: 0 DEBUG200 9-04-28 03:07:06 - Transient examples of: bpojob.Generated.BusinessObjects.JobItem DEBUG2009-04-28 03:07:06 - Savings transient examples DEBUG2009-04-28 03:07:06 - Savings [bpojob .Generated.BusinessObjects.JobItem # & lt; Null & gt;] DEBUG2009-04-28 03:07:06 - Implementation inclusion DEBUG2009-04-28 03:07:06 - Identification immediately 03:07:06 DEBUG2009-04-28 executed - insert unit: bpojob.Generated .BusinessObjects.JobItem (native ID) DEBUG2009-04-2 8 03:07:06 - opened new IDbCommand, open IDbCommands: 1 creating a IDbCommand object DEBUG2009-04-28 03:07:06 - SqlString? Inserting in Job_items (file name, job_id, position) values ​​(,?) DEBUG2009-04-28 03:07:06 - Dehydrated process unit: [bpojob.Generated.BusinessObjects.JobItem # & LT; Null & gt;] DEBUG2009-04-28 03:07:06 - 'Blue Hills.jpg' binding for parameters: DEBUG2009-04-28 03:07:06 - '8' binding for parameters: 1 DEBUG2009- 04-28 03:07:06 - '1' binding for the parameter: 2 DEBUG2009-04-28 03:07:06 - INSERT (? P0,? P1,? P2) in Job_Titm (filename, job_id, position) ; ? P0 = 'Blue Hills. Jpg ',? P1 = '8',? P2 = '1' DEBUG2009-04-28 03:07:06 - Receiving IDB connection from driver DEBUG2009-04-28 03:07:06 - Closed IDbCommand, Open IDB Commands: DEBUG2009-04-28 03:07 : 06 - Aggravating the Database Connection DEBUG2009-04-28 03:07:06 - Connection Closure DEBUG2009-04-28 03:07:06 - Can not be inserted: [bpojob.Generated.BusinessObjects. JobItem] [insert job_items (filename, job_id, status) values ​​(p0, P1, P2 ??)] MySql.Data.MySqlClient.MySqlException: duplicate entry for key 'blue hills.jpg' 'MySql.Data.MySqlClient MySqlStream.ReadPacket () in MySql.Data.MySqlClient.NativeDr iver.ReadResult (MySQL.Data.MySqlClient.MySqlDataReader.GetResultSet) to stay on MySql.Data (UInt64 and affect light, Int 64 Antiminsrtaidi). MySqlClient.MySqlDataReader.NextResult () (NHibernate.AdNet.AbstractBatcher.ExecuteNonQuery on MySql.Data.MySqlClient.MySqlComman on MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (command daywear behavior) MySql.Data.MySqlClient.MySqlCommand.ExecuteReader () see IDbCommand CMD) on NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert (SqlCommandInfo enter SQL, ISession supplementary session, IBinder binder) on d.ExecuteNonQuery ()  

as you All the information , debugs and exceptions are folded together, making it difficult to sift through the file, and Once the information bugs come out.

I want to put an exception information in a file, and I want to put the other information into another file. And I want to exclude debug info Release mode How to do this?

Use a separate file aper logger for error and warning in your log4net.xml

For more information, see


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -