-
September 3rd, 2020, 11:22 PM
#1
Log4NetLogging issue
In your demo for DotNet client 4.0.0, there is some code in the Log4NetLogging.cs file as follows
public ILogger GetLogger(string category)
{
lock (logInstances)
{
if (!logInstances.ContainsKey(category))
{
logInstances[category] = new Log4NetLoggerWrapper(log4net.LogManager.GetLogger( category));
I get a compile error on this last line for GetLogger(category) saying "cannot convert 'string' to 'System.Type'".
If I replace "category" in the call with a made-up Type argument, the Demo runs. I think I'm connected correctly, because I can send a log record to the console or the log file from my program. I notice that the config file only defines WARN level responses and no Appenders. This makes me wonder if I need to worry about this. Is it OK for me to continue without Log4Net logging?
Last edited by Chuck; September 3rd, 2020 at 11:30 PM.
-
September 4th, 2020, 09:53 AM
#2
Hi Chuck,
Are you referring to this project https://github.com/Lightstreamer/Lig.../for_version_4?
In this case I have no evidence of the compile error you mentioned.
About logging, you can leverage the log levels you need for your development and tests, an example of configuration is here: https://github.com/Lightstreamer/Lightstreamer-example-Quickstart-client-dotnet/blob/for_version_4/app.config
Regards,
Giuseppe
-
September 6th, 2020, 05:32 PM
#3
Greetings Giuseppe!
I got the Lightstreamer DotNet Client Version 4 Demo working. I thought you might be interested in case this comes up with someone else.
Since you were not experiencing the compile error that I was, I thought that the problem might be in Log4Net. I found that the compile error that I originally reported is due to an incompatibility between the example DotNet Client code and the Log4Net package that is version dependent. I was starting my configuration from scratch so I had installed the latest version of Log4Net from NuGet which is 2.0.9. The DotNet Client refers to GetLogger with one argument of type “string”. Log4Net dropped support for this overload in V2.0.6. So, I uninstalled Log4Net and reinstalled an older version V2.0.5. and the compile error went away, but I got the following run-time error:
Exception User-Unhandled
FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
I couldn’t find V4.0.3 but System.Configuration.ConfigurationManager 4.7.0 is available on NuGet so I installed that and the run-time error went away. I used the config file you linked to and got some incomplete lines in the log file with the default behavior, so I added APPENDER statements to the LOGGER specifications to explicitly refer to the file appender and now everything works as expected.
I thank you and your team for your support. I appreciate the quick responses.
Regards,
Chuck
Similar Threads
-
By Mone in forum Client SDKs
Replies: 0
Last Post: October 22nd, 2007, 10:20 AM
-
By Mone in forum Client SDKs
Replies: 0
Last Post: February 9th, 2007, 01:35 PM
-
By CitiMan in forum Client SDKs
Replies: 2
Last Post: November 21st, 2006, 01:55 PM
-
By Mone in forum Client SDKs
Replies: 0
Last Post: November 9th, 2006, 04:12 PM
-
By Mone in forum Client SDKs
Replies: 0
Last Post: November 7th, 2006, 11:24 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 02:58 PM.
Bookmarks