Increase DB field size for Payload column

Topics: Semantic Logging Application Block
Jun 18, 2013 at 11:25 AM
Hi,

The current db field (Payload) column is of nvarchar(4000). Are you folks truncating it to 4K characters or if I change this field to TEXT field, then would it just work fine?

If not, are there any workarounds to make that field TEXT and log large messages?

Regards,
Himanshu
Jun 18, 2013 at 5:53 PM
I don't believe that truncation will occur. If you exceed the length of the Payload column the record will not be inserted and an exception raised (with the usual "String or binary data would be truncated" message).

You should be able to change the size/type in the database:
  • Change the column definition on the table
  • Change the column definition of the TracesType Table Type
  • Change the parameter definition on the WriteTrace stored procedure (although this stored procedure is not called from the application block)
~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Jul 3, 2013 at 3:16 PM
Hey Randy,

I tried the above changes and the data is still getting truncated to 4K characters. I haven't checked the source but I think the data is getting truncated before writing to the DB from the library itself. This error (String or binary data would be truncated) is also NOT logged. I really don't want to fiddle with the library source and use my custom version. Only way I can think of is to write a custom sink which is similar to DB sink. Is there still a faster way out since I don't have much time.

Himanshu
Jul 3, 2013 at 6:23 PM
Yes, sorry about that; what I posted is necessary but not sufficient. The length metadata is set within Enterprise Library. To change you will either have to modify the source or create a new database sink.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to