I encountered a problem with log4net ADONetAppender not logging. It logs everything for EventLogAppender but not with ADONetAppender. Obviously, there is something wrong. First guess, something is wrong with configuration. I checked. All nodes and elements looks good. So what’s wrong. Then I need to know what is going on with log4net.
I found a really nice blog discussing the same.
Highlights of the blog: Enable tracing for Log4Net via adding configuration settings in config file.
I did that and found the issue in the log file.
Error: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Data type 0xE7 has an invalid
data length or metadata length.
Then, I landed to Microsoft Support Page while searching for what that means?
And there was the culprit. Its not my bug but microsoft’s.
If you specify adonetappender string data size value between 4001 and 8000 for n_var_char_max column data type, the above error occurs.
I have not found the solution yet but the microsoft support article has few work arounds.
- Set size to -1
- Set size to value other than 4001 – 8000
- Change column data type to n_text