You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ylu0105 (via GitHub)" <gi...@apache.org> on 2025/12/09 02:03:41 UTC
[I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
ylu0105 opened a new issue, #278:
URL: https://github.com/apache/logging-log4net/issues/278
static LogLog()
{
#if !NETCF
try
{
InternalDebugging = OptionConverter.ToBoolean(SystemInfo.GetAppSetting("log4net.Internal.Debug"), false);
QuietMode = OptionConverter.ToBoolean(SystemInfo.GetAppSetting("log4net.Internal.Quiet"), false);
EmitInternalMessages = OptionConverter.ToBoolean(SystemInfo.GetAppSetting("log4net.Internal.Emit"), true);
}
catch (Exception ex)
{
// If an exception is thrown here then it looks like the config file does not
// parse correctly.
//
// We will leave debug OFF and print an Error message
Error(typeof(LogLog), "Exception while reading ConfigurationSettings. Check your .config file is well formed XML.", ex);
}
#endif
}
Because the SystemInfo.GetAppSetting method may cause an exception, it can lead to the failure of the QuiteMode property setting for the user.
The following suggestions are for repair:
static LogLog()
{
#if !NETCF
try
{
QuietMode =true;
InternalDebugging = OptionConverter.ToBoolean(SystemInfo.GetAppSetting("log4net.Internal.Debug"), false);
QuietMode = OptionConverter.ToBoolean(SystemInfo.GetAppSetting("log4net.Internal.Quiet"), false);
EmitInternalMessages = OptionConverter.ToBoolean(SystemInfo.GetAppSetting("log4net.Internal.Emit"), true);
}
catch (Exception ex)
{
// If an exception is thrown here then it looks like the config file does not
// parse correctly.
//
// We will leave debug OFF and print an Error message
Error(typeof(LogLog), "Exception while reading ConfigurationSettings. Check your .config file is well formed XML.", ex);
}
#endif
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3713601561
@ylu0105 can you please provide a complete project?
Your code example is helpful, but not enough.
I don't know your target framework and many more details.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Bug on Util.LogLog ctor. (logging-log4net)
Posted by "ylu0105 (via GitHub)" <gi...@apache.org>.
ylu0105 closed issue #278: Bug on Util.LogLog ctor.
URL: https://github.com/apache/logging-log4net/issues/278
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "ylu0105 (via GitHub)" <gi...@apache.org>.
ylu0105 commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3636150513
> [@ylu0105](https://github.com/ylu0105) thanks. That makes the problem much clearer. Could you update to 3.2.0? The bug will be there, too. But 2.0.17 is no longer supported (see https://logging.apache.org/log4net/versioning.html) and we can only deliver fixes for 3.x.
Yes, Looking forward to the new version.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Bug on Util.LogLog ctor. (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3783363200
@ylu0105 can you provide the project?
Otherwise I will close this issue next week.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Bug on Util.LogLog ctor. (logging-log4net)
Posted by "ylu0105 (via GitHub)" <gi...@apache.org>.
ylu0105 commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3783475717
I have sidestepped this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "ylu0105 (via GitHub)" <gi...@apache.org>.
ylu0105 commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3692506418
> [@ylu0105](https://github.com/ylu0105) I'm trying to reproduce your problem, but my application works.
>
> I have a native x64 application (Delphi) hosting a .net 8 runtime. I have no config file, so ConfigurationManager falls back to machine.config and returns null.
After upgrading to version 3.2,new excecption occurred. "The type initializer for 'log4net.Core.LoggerManager' threw an exception."
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "ylu0105 (via GitHub)" <gi...@apache.org>.
ylu0105 commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3692511043
My code
``` csharp
using namespace log4net;
using namespace log4net::Repository;
ILoggerRepository^ repository = LogManager::GetRepository();
if (!repository->Configured)
{
String^ configPath = Path::Combine(AppDomain::CurrentDomain->BaseDirectory, "log4net.config");
if (File::Exists(configPath))
{
Config::XmlConfigurator::ConfigureAndWatch(repository, gcnew FileInfo(configPath));
}
else
{
Config::BasicConfigurator::Configure(repository);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3634301142
@ylu0105 What is the problem you're trying to solve?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "ylu0105 (via GitHub)" <gi...@apache.org>.
ylu0105 commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3634938237
> [@ylu0105](https://github.com/ylu0105) What is the problem you're trying to solve?
In order to enable native C++ to use log4net,I created a CLR encapsulation library for .net 8. I only use 'log4net.config' to configure the logs.so when the log4net try to read configration settings from 'app.config' which not exsits in my c++ project,it cause an internal exception "Exception while reading ConfigurationSettings. Check your .config file is well formed XML."
I try to set LogLog::QuiteMode(true) to disable exception message,bug it not work because of the above reason.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3636127702
@ylu0105 thanks. That makes the problem much clearer.
Could you update to 3.2.0?
The bug will be there, too. But 2.0.17 is no longer supported (see https://logging.apache.org/log4net/versioning.html) and we can only deliver fixes for 3.x.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [2.0.17]Bug on Util.LogLog ctor. (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #278:
URL: https://github.com/apache/logging-log4net/issues/278#issuecomment-3656090525
@ylu0105 I'm trying to reproduce your problem, but my application works.
I have a native x64 application (Delphi) hosting a .net 8 runtime.
I have no config file, so ConfigurationManager falls back to machine.config and returns null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org