[
https://issues.apache.org/jira/browse/LOG4NET-213?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Bodewig resolved LOG4NET-213.
------------------------------------
Resolution: Not A Problem
The file you are writing to is locked by the first process.
See
http://logging.apache.org/log4net/release/faq.html#How%20do%20I%20get%20multiple%20process%20to%20log%20to%20the%20same%20file?
> Problem while executing 2 windev applications
> ---------------------------------------------
>
> Key: LOG4NET-213
> URL: https://issues.apache.org/jira/browse/LOG4NET-213
> Project: Log4net
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 1.2.10
> Environment: Windows XP
> Reporter: Xavier Gosset
>
> I'm using log4net in .NET for a long time. It's a wonderfull product.
> I'm working now on Windev applications.
> These applications are using .NET objects without any problems.
> So, my idea was to use log4net in these applications.
> So, I encapsulated my needs in another .NET assembly:
> public class WDLogger
> {
> private StreamWriter _writer;
> private ILog _logger = null;
> public WDLogger()
> {
> }
> public void Load(string loggerName)
> {
> // For internal debug
> _writer = new System.IO.StreamWriter("c:\\" + loggerName +
> "_l4n.txt", true);
> _writer.AutoFlush = true;
> System.Console.SetOut(_writer);
> FileInfo fileInfo = new FileInfo("log4net.config");
> log4net.Config.XmlConfigurator.Configure(fileInfo);
> _logger = LogManager.GetLogger(loggerName);
> }
> public void TraceDebug(string message)
> {
> if (_logger != null && _logger.IsDebugEnabled)
> _logger.Debug(message);
> }
> public void TraceInfo(string message)
> {
> if (_logger != null && _logger.IsInfoEnabled)
> _logger.Info(message);
> }
> public void TraceWarn(string message)
> {
> if (_logger != null && _logger.IsWarnEnabled)
> _logger.Warn(message);
> }
> public void TraceError(string message)
> {
> if (_logger != null && _logger.IsErrorEnabled)
> _logger.Error(message);
> }
> public void TraceFatal(string message)
> {
> if (_logger != null && _logger.IsFatalEnabled)
> _logger.Fatal(message);
> }
> }
> I have two applications, A and B.
> When I start the application A, the traces are written successfully.
> When I start the application B, traces of this are not written.
> I stop the two applications.
> If I start application B, the traces are written successfully.
> If I start application A after, traces of this are not written.
> I activated log4net internal debug.
> And there is only one difference.
> Here is the log of application started first:
> ...
> log4net: FileAppender: Opening file for writing
> [E:\temp\testlogging\Exe\Logging\NaomiServerLog.txt] append [True]
> log4net: XmlHierarchyConfigurator: Created Appender
> [NaomiServerRollingFileAppender]
> log4net: XmlHierarchyConfigurator: Adding appender named
> [NaomiServerRollingFileAppender] to logger [NaomiServer].
> log4net: XmlHierarchyConfigurator: Hierarchy Threshold []
> INFO (2009-04-23 15:36:26,250 - toto) [Info1]
> INFO (2009-04-23 15:36:26,265 - toto) [Info2]
> Here is the log of the second application:
> ...
> log4net: FileAppender: Opening file for writing
> [E:\temp\testlogging\Exe\Logging\NaomiServerLog.txt] append [True]
> log4net: XmlHierarchyConfigurator: Created Appender
> [NaomiServerRollingFileAppender]
> log4net: XmlHierarchyConfigurator: Adding appender named
> [NaomiServerRollingFileAppender] to logger [NaomiServer].
> log4net: XmlHierarchyConfigurator: Hierarchy Threshold []
> log4net: FileAppender: Opening file for writing
> [E:\temp\testlogging\Exe\Logging\ListenerLog.txt] append [True]
> log4net: FileAppender: Opening file for writing
> [E:\temp\testlogging\Exe\Logging\ListenerLog.txt] append [True]
> Do you have an idea of what it could be?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira