logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LOG4NET-253) GetLogger creates rolling files even for the unreferenced files
Date Tue, 06 Sep 2011 11:24:10 GMT

     [ https://issues.apache.org/jira/browse/LOG4NET-253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stefan Bodewig updated LOG4NET-253:
-----------------------------------

    Fix Version/s: 1.2 Maintenance Release

> GetLogger creates rolling files even for the unreferenced files
> ---------------------------------------------------------------
>
>                 Key: LOG4NET-253
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-253
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.10
>         Environment: Windows XP
>            Reporter: Yves Bastiand
>             Fix For: 1.2 Maintenance Release
>
>
> Hi,
> I have a C# solution that contains three executables. I have each of these three executables
sharing the same log4net configuration file. At startup of each of the executable, they retrieve
a logger (one logger per executable, as per configuration file further below). When one of
the executable performs Log.GetLogger(<loggerName>), it creates all the rolling files
instead of only the one rolling file that is referred to as appender-ref in the executable's
logger configuration.
> For instance, when I startup my sending daemon executable, it performs Log.GetLogger("SendingDaemonLogger")
which creates 3 files  Log/RuleScheduler.txt, Log/NotificationGenerator.txt and Log/NotificationSender.txt
 instead of only the desired Log/NotificationSender.txt.
> Then when I startup another of the executables, for instance the rule scheduler daemon,
this other process cannot write in Log/RuleScheduler.txt because it has been created and locked
by the sending daemon process.
> I am guessing that there may be three different solutions to my problem:
> 1. The GetLogger should only create the rolling file appenders that are referenced in
the config
> 2. I should have one config file per executable, this way each config file could list
only one rolling file appender and starting each of the executable would not create the rolling
files of the other daemons. I am however reluctant to do this because some of the configuration
(SMTP appender, console appender) is shared between the daemons and I don't want to have duplicate
copies to maintain. Unless there is a way to have a config file including another one?
> 3. Maybe there is a way to configure the rolling file so that concurrent access across
processes is allowed? This solution still isn't perfect in my opinion because any of the daemons
should not be creating the rolling files of some other daemons.
> Thanks in advance for your help!
> My configuration file is below:
> <?xml version="1.0" encoding="utf-8" ?>
> <log4net>
>   <appender name="RuleSchedulerFileAppender" type="log4net.Appender.RollingFileAppender">
>     <file value="Log/RuleScheduler.txt"/>
>     <threshold value="INFO"/>
>     <appendToFile value="true"/>
>     <!-- For each month, keep up to 100 files of 10Mb within the month-->
>     <rollingStyle value="Composite" />
>     <datePattern value="yyyyMM" />
>     <maxSizeRollBackups value="100" />
>     <maximumFileSize value="10MB" />
>     <!-- The latest log file has the greatest number -->
>     <countDirection value="1" />
>     <layout type="log4net.Layout.PatternLayout">
>       <conversionPattern value="%ndc [%thread] %date %-4timestamp %-5level %message
(%method(), L%line %class)  %newline%exception"/>
>     </layout>
>   </appender>
>   <appender name="NotificationGeneratorFileAppender" type="log4net.Appender.RollingFileAppender">
>     <file value="Log/NotificationGenerator.txt"/>
>     <threshold value="INFO"/>
>     <appendToFile value="true"/>
>     <!-- For each month, keep up to 100 files of 10Mb within the month-->
>     <rollingStyle value="Composite" />
>     <datePattern value="yyyyMM" />
>     <maxSizeRollBackups value="100" />
>     <maximumFileSize value="10MB" />
>     <!-- The latest log file has the greatest number -->
>     <countDirection value="1" />
>     <layout type="log4net.Layout.PatternLayout">
>       <conversionPattern value="%ndc [%thread] %date %-4timestamp %-5level %message
(%method(), L%line %class)  %newline%exception"/>
>     </layout>
>   </appender>
>   <appender name="NotificationSenderFileAppender" type="log4net.Appender.RollingFileAppender">
>     <file value="Log/NotificationSender.txt"/>
>     <threshold value="INFO"/>
>     <appendToFile value="true"/>
>     <!-- For each month, keep up to 100 files of 10Mb within the month-->
>     <rollingStyle value="Composite" />
>     <datePattern value="yyyyMM" />
>     <maxSizeRollBackups value="100" />
>     <maximumFileSize value="10MB" />
>     <!-- The latest log file has the greatest number -->
>     <countDirection value="1" />
>     <layout type="log4net.Layout.PatternLayout">
>       <conversionPattern value="%ndc [%thread] %date %-4timestamp %-5level %message
(%method(), L%line %class)  %newline%exception"/>
>     </layout>
>   </appender>
>   <appender name="DebugConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
>     <threshold value="ALL"/>
>     <mapping>
>       <level value="FATAL" />
>       <foreColor value="White" />
>       <backColor value="Red, HighIntensity" />
>     </mapping>
>     <mapping>
>       <level value="ERROR" />
>       <backColor value="Red, HighIntensity" />
>     </mapping>
>     <mapping>
>       <level value="WARN" />
>       <backColor value="Yellow, HighIntensity" />
>     </mapping>
>     <mapping>
>       <level value="DEBUG" />
>       <backColor value="Green" />
>     </mapping>
>     <mapping>
>       <level value="INFO" />
>       <foreColor value="White" />
>     </mapping>
>     <layout type="log4net.Layout.PatternLayout">
>       <conversionPattern value="%ndc [%thread] %date %-4timestamp %-5level %logger
%message (%method(), L%line %class)  %newline%exception" />
>     </layout>
>   </appender>
>   <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">
>     <threshold value="ERROR" />
>     <to value="biopacs-notification@bioclinica.com" />
>     <from value="biopacs.notification.server.logger@bioclinica.com" />
>     <subject value="Alert in BioPACS notification server" />
>     <smtpHost value="biomail04.biodoma04.bi.corp" />
>     <bufferSize value="0" />
>     <layout type="log4net.Layout.PatternLayout">
>       <conversionPattern value="%ndc [%thread] %date %-4timestamp %-5level %logger
%message (%method(), L%line %class)  %newline%exception" />
>     </layout>
>   </appender>
>   <root>
>     <level value="ALL" />
>   </root>
>   <logger name="RuleSchedulerLogger" additivity="true">
>     <level value="ALL"/>
>     <appender-ref ref="SmtpAppender"/>
>     <appender-ref ref="DebugConsoleAppender"/>
>     <appender-ref ref="RuleSchedulerFileAppender"/>
>   </logger>
>   <logger name="NotificationGeneratorLogger" additivity="true">
>     <level value="ALL"/>
>     <appender-ref ref="SmtpAppender"/>
>     <appender-ref ref="DebugConsoleAppender"/>
>     <appender-ref ref="NotificationGeneratorFileAppender"/>
>   </logger>
>   <logger name="SendingDaemonLogger" additivity="true">
>     <level value="ALL"/>
>     <appender-ref ref="SmtpAppender"/>
>     <appender-ref ref="DebugConsoleAppender"/>
>     <appender-ref ref="NotificationSenderFileAppender"/>
>   </logger>
> </log4net>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message