Re: Issue with no Logger.Appenders even though log shows config successfully loaded

2017-02-05 Thread John Gold
Fixed!,

Needed to go to the Logger.Parent to get the Appenders.

http://stackoverflow.com/questions/41210018/issue-with-no-log4net-logger-appenders-even-though-log-shows-config-successfully/42057416#42057416

Also ErrorUnit is now compatible with log4net!

Generate Unit test replicating error logged in your environments!


On Sun, Dec 18, 2016 at 10:37 AM, John Gold  wrote:

> I would appreciate any help you can provide? Not sure what I am doing
> wrong...
>
> I am creating a log4net compatibility library for my new Visual Studio
> tool ErrorUnit at https://github.com/JohnGoldInc/ErrorUnit.Logger_log4net
>
> Line 37 of https://github.com/JohnGoldInc/ErrorUnit.Logger_log4net/
> blob/master/ErrorUnitLogger.cs has Count=0 Appenders even though my log
> shows that appenders were loaded:
>
> ...
> 16 namespace ErrorUnit.Logger_log4net
> 17 {
> 18public class ErrorUnitLogger : ILogger
> 19{
> 20private static ILog log = LogManager.GetLogger(typeof(Er
> rorUnitLogger));
> 21
> 22public IEnumerable GetErrorUnitJson(DateTime afterdate)
> 23{
> 24var ErrorUnitJson = new ConcurrentBag();
> 25log4net.Util.LogLog.InternalDebugging = true; //todo remove
> 26System.Diagnostics.Trace.Listeners.Add(new
> System.Diagnostics.TextWriterTraceListener(@"f:\Temp\Logger_log4net.log",
> "myListener"));
> 27System.Diagnostics.Trace.AutoFlush = true;
> 28System.Diagnostics.Trace.TraceInformation("Test
> Logger_log4net message.");
> 29
> 30var config = log4net.Config.XmlConfigurator.Configure();
> 31log = LogManager.GetLogger(typeof(ErrorUnitLogger));
> 32
> 33// Parallel.ForEach(logs, log => {
> 34var log4net_Logger = log.Logger as
> log4net.Repository.Hierarchy.Logger;
> 35if (log4net_Logger != null)
> 36{
> 37Parallel.ForEach(log4net_Logg
> er.Appenders.Cast(), appender =>
> ...
>
> For the log ( the log without ellipsis is at
> https://github.com/JohnGoldInc/ErrorUnit.Logger_log4net/
> blob/master/README.md ):
>
> devenv.exe Information: 0 : Test Logger_log4net message.
> log4net: configuring repository [log4net-default-repository] using .config
> file section
> log4net: Application config file is [F:\Documents\Visual Studio
> 2015\Projects\WebApplication1\WebApplication1.Tests\obj\Release]
> log4net: Configuring Repository [log4net-default-repository]
> log4net: Configuration update mode [Merge].
> ...
> log4net: Created Appender [AdoNetAppender]
> log4net: Adding appender named [AdoNetAppender] to logger [root].
> log4net: Hierarchy Threshold []
> ...
>
> Thanks!
>
>


Issue with no Logger.Appenders even though log shows config successfully loaded

2016-12-18 Thread John Gold
I would appreciate any help you can provide? Not sure what I am doing
wrong...

I am creating a log4net compatibility library for my new Visual Studio tool
ErrorUnit at https://github.com/JohnGoldInc/ErrorUnit.Logger_log4net

Line 37 of https://github.com/JohnGoldInc/ErrorUnit.Logger_
log4net/blob/master/ErrorUnitLogger.cs has Count=0 Appenders even though my
log shows that appenders were loaded:

...
16 namespace ErrorUnit.Logger_log4net
17 {
18public class ErrorUnitLogger : ILogger
19{
20private static ILog log = LogManager.GetLogger(typeof(
ErrorUnitLogger));
21
22public IEnumerable GetErrorUnitJson(DateTime afterdate)
23{
24var ErrorUnitJson = new ConcurrentBag();
25log4net.Util.LogLog.InternalDebugging = true; //todo remove
26System.Diagnostics.Trace.Listeners.Add(new System.Diagnostics.
TextWriterTraceListener(@"f:\Temp\Logger_log4net.log", "myListener"));
27System.Diagnostics.Trace.AutoFlush = true;
28System.Diagnostics.Trace.TraceInformation("Test
Logger_log4net message.");
29
30var config = log4net.Config.XmlConfigurator.Configure();
31log = LogManager.GetLogger(typeof(ErrorUnitLogger));
32
33// Parallel.ForEach(logs, log => {
34var log4net_Logger = log.Logger as
log4net.Repository.Hierarchy.Logger;
35if (log4net_Logger != null)
36{
37
Parallel.ForEach(log4net_Logger.Appenders.Cast(),
appender =>
...

For the log ( the log without ellipsis is at https://github.com/
JohnGoldInc/ErrorUnit.Logger_log4net/blob/master/README.md ):

devenv.exe Information: 0 : Test Logger_log4net message.
log4net: configuring repository [log4net-default-repository] using .config
file section
log4net: Application config file is [F:\Documents\Visual Studio
2015\Projects\WebApplication1\WebApplication1.Tests\obj\Release]
log4net: Configuring Repository [log4net-default-repository]
log4net: Configuration update mode [Merge].
...
log4net: Created Appender [AdoNetAppender]
log4net: Adding appender named [AdoNetAppender] to logger [root].
log4net: Hierarchy Threshold []
...

Thanks!