gt; BasicConfigurator.Configure(appender);
>
> ILog log = LogManager.GetLogger(typeof(Form1));
> log.Debug("Hello World");
> }
> }
>
> ----------
> *From:* Michael SALOMON
> *To:* Log4NET User
> *Sent:* Friday,
);
ILog log = LogManager.GetLogger(typeof(Form1));
log.Debug("Hello World");
}
}
From: Michael SALOMON
To: Log4NET User
Sent: Friday, June 26, 2009 1:18:49 PM
Subject: Re: Problem using a ConsoleAppender in a Windows Form applicat
ColoredConsoleAppender calls Console.OpenStandardOutput() in ActivateOptions to
store a Stream that represents the console. When you create a console in a
WinForm app you need to call ActivateOptions again so the internal Stream can
be re-initialized:
public partial class Form1 : Form
{
[Dl
Well, I tried this and it still does not work:
if (AllocConsole())
AttachConsole(-1);
// this file exists
XmlConfigurator.ConfigureAndWatch(new
System.IO.FileInfo("./Log4Net.config"));
LogManager.GetLogger("DebugLogger").Debug("
thx for your answer ! i'll try that but then I need to change my approach.
Originally I wanted to attach a console depending on log4net config, so now
i will try to detach the console depending on the config ;)
I don't mind doing that
I'll let you know if it works.
2009/6/26 Radovan Raszka
>
Hello,
try to allocate your console _before_ log4net is configured.
Radovan
Od: Michael SALOMON [mailto:michaelsalomo...@gmail.com]
Odesláno: 26. června 2009 15:22
Komu: log4net-user@logging.apache.org
Předmět: Problem using a ConsoleAppender in a Windows Form app