Skip to content

Feature suggestion - Provide ability for custom columns to use different Serilog properties #182

Closed
@rocknet

Description

@rocknet

It would be helpful to have the ability to use a Serilog property name other than the ColumnName of the custom column. This is especially true with applications that already had a logging implementation (e.g. log4net) logging to SQL Server. Given the available enrichers, sometimes the property name in Serilog varies from your custom column and for various reasons changing the column is sub-optimal.

Also in the case where different processes are logging to the same table, you might have two different property names that you want to log to the same column. For example, in a web application you could use the UserName from HttpContext, but in a traditional application, EnvironmentUserName might make more sense.

Suggest allowing configuring SqlColumn with a new PropertyName attribute. If provided, that property value will be used for filling the DataTable, otherwise the property with the same name as ColumnName is used.

FWIW, I have this implementation done in a fork, let me know if a PR is welcome.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions