Modify loggingConfiguration Programmatic (enterprise library)

Posted by alhambraeidos on Stack Overflow See other posts from Stack Overflow or by alhambraeidos
Published on 2010-04-14T18:59:45Z Indexed on 2010/04/14 19:03 UTC
Read the original article Hit count: 352

Hi all,

I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1).

I need do this programatically,

Get a list of all listener in loggingConfiguration

Modify property fileName=".\Trazas\Excepciones.log" of several RollingFlatFileTraceListener's

Modify several properties of AuthenticatingEmailTraceListener listener,

Any help, please, I havent found any reference or samples

Thanks in advanced. Greetings

<listeners>

  <add name="Excepciones RollingFile Listener" fileName=".\Trazas\Excepciones.log" 
       formatter="Text Single Formatter" 
       footer="&lt;/Excepcion&gt;" 
       header="&lt;Excepcion&gt;"
       rollFileExistsBehavior="Overwrite" rollInterval="None" rollSizeKB="1500" 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="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />


  <add name="AuthEmailTraceListener"
            type="zzzz.Frk.Logging.AuthEmailTraceListener.AuthenticatingEmailTraceListener, zzzz.Frk.Logging.AuthEmailTraceListener"
            listenerDataType="zzzz.Frk.Logging.AuthEmailTraceListener.AuthenticatingEmailTraceListenerData, zzzz.Frk.Logging.AuthEmailTraceListener"
            formatter="Exception Formatter"
            traceOutputOptions="None"
            toAddress="[email protected]"
            fromAddress="[email protected]"
            subjectLineStarter=" Excepción detectada - "
            subjectLineEnder="incidencias"
            smtpServer="smtp.gmail.com"
            smtpPort="587" 
            authenticate="true"
            username="[email protected]"
            password="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
            enableSsl="true"
       />

© Stack Overflow or respective owner

Related posts about enterprise-library

Related posts about logging