Click here to Skip to main content
15,914,419 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem in Class Pin
OriginalGriff4-Jun-10 8:50
mveOriginalGriff4-Jun-10 8:50 
GeneralRe: problem in Class Pin
Luc Pattyn4-Jun-10 9:30
sitebuilderLuc Pattyn4-Jun-10 9:30 
GeneralRe: problem in Class Pin
OriginalGriff4-Jun-10 9:41
mveOriginalGriff4-Jun-10 9:41 
GeneralRe: problem in Class [modified] Pin
Luc Pattyn4-Jun-10 9:49
sitebuilderLuc Pattyn4-Jun-10 9:49 
GeneralRe: problem in Class Pin
OriginalGriff4-Jun-10 11:53
mveOriginalGriff4-Jun-10 11:53 
GeneralRe: problem in Class Pin
Luc Pattyn4-Jun-10 11:57
sitebuilderLuc Pattyn4-Jun-10 11:57 
AnswerRe: problem in Class Pin
Not Active4-Jun-10 6:57
mentorNot Active4-Jun-10 6:57 
QuestionEnterprise Library Logging Application Block: using special sources Pin
Shtel4-Jun-10 3:16
Shtel4-Jun-10 3:16 
Hello all,

I have configured my logging application block as follows, using Enterprise Libaray 4.1 (in app.config):

<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
 <logFilters>
 <add
  name="LogEnabled Filter"
  type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter, Microsoft.Practices.EnterpriseLibrary.Logging"
  enabled="true"
  />
 
 <listeners>

 <add
  name="Rolling Flat File Trace Listener Debug"
  fileName="Logs/Debug.log"
  header="------HEADER-------"
  footer=""
  formatter="Text Formatter"
  rollFileExistsBehavior="Overwrite"
  rollInterval="Day"
  rollSizeKB="10000"
  timeStampPattern="yyyy-MM-dd"
  listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  traceOutputOptions="None"
  filter="Verbose"
  type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  />

 <add
  name="Rolling Flat File Trace Listener Unprocessed"
  fileName="Logs/Unprocessed.log"
  header="-------------"
  footer=""
  formatter="Text Formatter"
  rollFileExistsBehavior="Overwrite"
  rollInterval="Day"
  rollSizeKB="10000"
  timeStampPattern="yyyy-MM-dd"
  listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  traceOutputOptions="None"
  filter="Verbose"
  type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  />

 <add
  fileName="Logs/RawLogHistory/RawLogHistory.log"
  name="Rolling Flat File Trace Listener Full History"
  header=""
  footer=""
  formatter="Text Formatter"
  rollFileExistsBehavior="Overwrite"
  rollInterval="Day"
  rollSizeKB="10000"
  timeStampPattern="yyyy-MM-dd"
  listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  traceOutputOptions="None"
  filter="Verbose"
  type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  />

</listeners>
 <formatters>
 <add
  name="Text Formatter"
  template=" {severity} [{timestamp}] {message}"
  type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  />
 </formatters>

 <categorySources>

 <add switchValue="All" name="General">
  <listeners>
  <add name="Rolling Flat File Trace Listener Debug"/>
  </listeners>
 </add>

 <add switchValue="All" name="Debug">
  <listeners>
  <add name="Rolling Flat File Trace Listener Debug"/>
  </listeners>
 </add>

 <add switchValue="All" name="Exception">
  <listeners>
  <add name="Rolling Flat File Trace Listener Release"/>
  <add name="Formatted EventLog TraceListener Formicary"/>
  </listeners>
 </add>
  </listeners>
 </add>

 </categorySources>

 <specialSources>

 <allEvents switchValue="All" name="All Events"/>

 <notProcessed switchValue="All" name="Unprocessed Category"/>
  <listeners>
  <add name="Rolling Flat File Trace Listener Unprocessed"/>
  </listeners>
 </notProcessed>

 <errors switchValue="Information" name="Logging Errors &amp; Warnings">
  <listeners>
  <add name="Rolling Flat File Trace Listener Debug"/>
  </listeners>
 </errors>

 </specialSources>

</loggingConfiguration>




Everything works fine.

The only issue i have, is with the "Unprocessed Category" special source.

Reading the documentation from msdn for EntLib L.A.B., i undestood that when you try and log to a Category that is not specified, that LogEntry is directed to the Unprocessed Category source.

In the above example though, if i log a Verbose message, and define the category in the LogEntry to be let's say "Undefined" (which is not specified in the configuration), i loose that LogEntry completely. Ideally, when the application attempts to log, it should do the following steps:
-Get the LogEntry and pass it through the logfilters.
-If it passes through the logfilters, find the category that the logentry specifies, and pass it to the listeners in that category
(in our current case, category is "Undefined")
-If you can't find the category specified in the LogEntry,go to the "Unprocessed Category" special source and log it to the listeners specified in there.

BUT:
!!Last step is never executed. I do not get the log in my flat file!!
NOTES:
-I have double checked, and the filters for both
the listeners and the categories are not blocking the LogEntry because of the level of message (verbose, information, etc...)
-The other special sources ("All Events" and "Logging Errors & Warnings") work fine.


Any suggestions on why this is the case?

Any hints would be appreciated.



Regards,

Shtel
QuestionFinding base class of an object Pin
dashingsidds4-Jun-10 3:07
dashingsidds4-Jun-10 3:07 
AnswerRe: Finding base class of an object Pin
JoeSharp4-Jun-10 3:27
JoeSharp4-Jun-10 3:27 
AnswerRe: Finding base class of an object Pin
Anthony Mushrow4-Jun-10 3:45
professionalAnthony Mushrow4-Jun-10 3:45 
GeneralRe: Finding base class of an object Pin
dashingsidds4-Jun-10 4:25
dashingsidds4-Jun-10 4:25 
AnswerRe: Finding base class of an object Pin
#realJSOP4-Jun-10 4:52
professional#realJSOP4-Jun-10 4:52 
QuestionIssue with Environment.SpecialFolder.MyDocuments Pin
False Chicken4-Jun-10 2:09
False Chicken4-Jun-10 2:09 
AnswerRe: Issue with Environment.SpecialFolder.MyDocuments Pin
Johnny J.4-Jun-10 2:16
professionalJohnny J.4-Jun-10 2:16 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
False Chicken4-Jun-10 2:22
False Chicken4-Jun-10 2:22 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
Johnny J.4-Jun-10 2:23
professionalJohnny J.4-Jun-10 2:23 
Questioncolor get changed in another pc Pin
eraser9504-Jun-10 2:03
eraser9504-Jun-10 2:03 
AnswerRe: color get changed in another pc Pin
OriginalGriff4-Jun-10 2:26
mveOriginalGriff4-Jun-10 2:26 
AnswerRe: color get changed in another pc Pin
Hristo-Bojilov4-Jun-10 2:27
Hristo-Bojilov4-Jun-10 2:27 
QuestionConvert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Add44-Jun-10 0:55
Add44-Jun-10 0:55 
AnswerRe: Convert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Hristo-Bojilov4-Jun-10 1:55
Hristo-Bojilov4-Jun-10 1:55 
QuestionHow to control a outer application? [modified] Pin
imbiz3-Jun-10 23:46
imbiz3-Jun-10 23:46 
AnswerRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 0:38
sitebuilderLuc Pattyn4-Jun-10 0:38 
GeneralRe: How to control a outer application? Pin
imbiz4-Jun-10 2:20
imbiz4-Jun-10 2:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.