Thursday, February 09, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: Key cannot be null error
Prev Next
You are not authorized to post a reply.

Author Messages
Gary Cooper

05/21/2009 12:02 AM  
Hello,
 
Could someone explain to me what the following error means please?
 
log4net:ERROR [AdoNetAppender] Could not open database connection []
System.ArgumentNullException: Key cannot be null.
Parameter name: key
 
I encounter this error when trying to log to my database. The rows are updated, but I get this message pop up on the console. I dont know how busy this list is, but I would really appreciate it if someone could lend a hand.
 
TIA

Karim Bourouba

05/21/2009 10:43 AM  
Hi Gary,
 
I am actually having the same problem as you - I think. I definitely get the same error as you. Can I ask if you are using MySql at all?
 
Unfortunately though, I havent had any luck with asking this question on this list, it would appear that the list is not as busy as I thought it initially was, or the other subscribers are unable to comment.
 
To help you with your problem, if it isnt the same as mine, would be to post your code on the list itself. That gives everyone the chance to take a look and see if they can spot the issue.
 
If you do have the same problem as me, could you post your solution should you fix it? That way others, including myself will be able to resolve this in future.
Radovan Raszka

05/21/2009 12:43 PM  
Hello,
you can try this:
download log4net sources and attach them to your project instead of reference to log4net.dll. Now you'll be able to debug inside of AdonetAppender and you can find what exactly is null and guess the correct value, I hope.
Radovan Raszka
Karim Bourouba

05/21/2009 12:52 PM  
Hi Radovan,
 
thats a great idea, I will give it a go and report back. Many thanks

Gary Cooper

05/21/2009 10:57 PM  
Thanks for your replies Karim & Radovan.
 
I have attempted to track down the problem with the log4net source, but this doesnt seem to have yielded much success. I am thinking that this could possibly be an error with MySql connector as opposed to log4net, after all this doesnt seem to be happening with SQL Server or Oracle (or at least it isnt being reported).
 
Karim, I think I followed your example on DevShed concerning this setup, I would like to thankyou for putting that together and I look forward to reading your blog article on this, I hope one of us will be able to overcome this problem - unfortunately, I dont have access to another DB to test this out on, but it would be nice to hear back from someone using the same code with Oracle or SQL Server.

 
Ron Grabowski

05/22/2009 3:05 AM  
Are you sure you're providing a valid connection string property? The latest source code contains this code:

                // Sadly, your connection string is bad.
                ErrorHandler.Error("Could not open database connection [" + resolvedConnectionString + "]. Connection string context [" + connectionStringContext + "].", e);

which seems to match your error message.

Can you paste your appender node to the list?
 
Karim Bourouba

05/22/2009 3:45 PM  
Hi Gary,
 
I have access to an SQL Server, so I will try out my code against it later this evening. If you did follow my post on DevShed, then we will more or less have the same code.
 
If it produces the same error or not, I will post back the results here.



Karim Bourouba

05/26/2009 11:42 AM  
hey there,
 
I tried the same code configured for SQL Server and this problem did not occur. I am starting to think that this could be a problem, however I am unsure if it is an issue with log4net or an issue with the MySql connector. I also tried this with the latest version of the connector for MySql and got the same problem...


You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Key cannot be null error



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement