Skip to content

Commit

Permalink
Extend README.md with explanation about the trimming effect when the …
Browse files Browse the repository at this point in the history
…field lengths are set to a specific size
  • Loading branch information
andypeeters authored and ckadluba committed Jun 17, 2022
1 parent 8230a31 commit 5c0b80f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ A flag specifiying if the log events table should be created if it does not exis
### EnlistInTransaction

A flag to make logging SQL commands take part in ambient transactions. It defaults to `false`.
Logging operations could be affected from surrounding `TransactionScope´s in the code, leading to log data
Logging operations could be affected from surrounding `TransactionScopes in the code, leading to log data
being removed on a transaction rollback. This is by default prevented by the sink adding `Enlist=false` to
the `ConnectionString` that is passed. This option can be used to change this behavior so that `Enlist=true`
is added instead (which is the default for SQL connections) and logging commands might be part of transactions.
Expand Down Expand Up @@ -460,10 +460,14 @@ _BigInt data type:_ For very large log tables, if you absolutely require an iden

This column stores the formatted output (property placeholders are replaced with property values). It defaults to `nvarchar(max)`. The `DataType` property can only be set to character-storage types.

In case `DataLength` is set to a specific value different from -1 or 0, any message longer than that length will be effectively trimmed down to that size. Example: `DataLength` is set to 15 and the message is "this is a very long message" (without the quotes), the trimmed text stored in the database will be: "this is a ve..." (again without quotes).

### MessageTemplate

This column stores the log event message with the property placeholders. It defaults to `nvarchar(max)`. The `DataType` property can only be set to character-storage types.

In case `DataLength` is set to a specific value different from -1 or 0, any template text longer than that length will be effectively trimmed down to that size. Any trimming ignores all differences between the tokens in the template meaning that a template might get cut off in the middle of a property token. Example: `DataLength` is set to 20 and the message template is "a long {NumberOfCharacters} template text" (without the quotes), the final template stored in the database will be: "a long {NumberOfC..." (again without quotes).

### Level

This column stores the event level (Error, Information, etc.). For backwards-compatibility reasons it defaults to a length of 128 characters, but 12 characters is recommended. Alternately, the `StoreAsEnum` property can be set to `true` which causes the underlying level enum integer value to be stored as a SQL `tinyint` column. The `DataType` property can only be set to `nvarchar` or `tinyint`. Setting the `DataType` to `tinyint` is identical to setting `StoreAsEnum` to `true`.
Expand Down

0 comments on commit 5c0b80f

Please sign in to comment.